757bb20871
keystoneauth 5.2.0 adds typing and corrects a number of bugs as part of this. One of the fixes included is that the 'system_scoped' property of the 'keystoneauth1.access.access.AccessInfoV3' class now returns True or False, rather than True or None as was the case previously [1]. This necessitates a fix for a unit test that was asserting the previous behavior. However, the process of fixing this test highlights the fact that these tests are pretty broken. The test is question appears to be asserting that the value of the 'system_scoped' attribute of the User changes from False to None, however, the value never actually changes: 'unittest.TestCase.assertFalse' asserts that a value is Falsey, not False [1], and the value is always None because we are using a (fake) unscoped token rather than a (fake) system-scoped token. We are also mocking the auth calls with a consistent value, which affects both the attempt to rescope (intended) and the initial auth (unintended). Finally, we appear to be check that a project-list call uses the new token, but this call happens before our attempt to rescope so it actually uses the old token. We simply didn't notice because we were using the same token in both cases. Correct this by returning different tokens for the initial auth request and the rescope test, then update the assertion to check for True as expected. This necessitates moving and updating the assertion for the project list call to reflect reality. We also add a missing test case. [1] https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertFalse Change-Id: I13873300bf789a6112b7b22567b258cba50e4373 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> |
||
---|---|---|
.. | ||
conf | ||
templates/auth | ||
unit | ||
__init__.py | ||
data_v3.py | ||
settings.py | ||
urls.py |