Pretty much every test case in 'nova.tests.functional' defines an 'api'
attribute, and many define an 'admin_api' attribute. We can pull these
from the class rather than explicitly passing them to helpers. Rework
things so this happens.
Note that the bulk of the changes here are in the
'nova/tests/functional/integrated_helpers.py' file. The rest of the
changes were auto-generated using the following script (my sed-fu is
non-existent):
$ cd nova/tests/functional
$ python3
>>> import glob
>>> import re
>>> pattern = r'_state_change\((\n\s+)?self\.(admin_)?api,\s+'
>>> replace = r'_state_change(\1'
>>> for path in glob.glob('*.py') + glob.glob('*/*.py'):
... with open(path) as fh:
... data = fh.read()
... new = re.sub(pattern, replace, data, flags=re.MULTILINE)
... if new != data:
... with open(path, 'w') as fh:
... fh.write(new)
...
>>> quit()
(ditto for the other substitutions)
Some manual fixups were required after, which pre-commit highlighted :)
Change-Id: I8c96b337f32148f8f5899c9b87af331b1fa41424
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>