openstack-charmers / zaza

A Python3-only functional test framework for Charms
Apache License 2.0
10 stars 46 forks source link

[stable/train] unit tests asserts need fixing as then break in unit tests #644

Open ajkavanagh opened 7 months ago

ajkavanagh commented 7 months ago

Note this is on the stable/train branch.

See the following:

======================================================================
ERROR: test_series_upgrade (unit_tests.utilities.test_zaza_utilities_generic.TestGenericUtils)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/zaza/zaza/unit_tests/utilities/test_zaza_utilities_generic.py", line [24](https://github.com/openstack-charmers/zaza/actions/runs/7213515614/job/19653554428?pr=637#step:6:25)6, in test_series_upgrade
    self.block_until_all_units_idle.called_with()
  File "/home/runner/work/zaza/zaza/.tox/py/lib/python3.8/site-packages/mock/mock.py", line 695, in __getattr__
    raise AttributeError(
AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.

======================================================================
ERROR: test_block_until_auto_reconnect_model_disconnected_async (unit_tests.test_zaza_model.TestModel)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/zaza/zaza/unit_tests/test_zaza_model.py", line 453, in test_block_until_auto_reconnect_model_disconnected_async
    self.Model_mock.connect_model.has_calls([mock.call('modelname'),
  File "/home/runner/work/zaza/zaza/.tox/py/lib/python3.8/site-packages/mock/mock.py", line 695, in __getattr__
    raise AttributeError(
AttributeError: 'has_calls' is not a valid assertion. Use a spec for the mock if 'has_calls' is meant to be an attribute.

======================================================================
ERROR: test_block_until_auto_reconnect_model_disconnected_sync (unit_tests.test_zaza_model.TestModel)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/zaza/zaza/unit_tests/test_zaza_model.py", line 438, in test_block_until_auto_reconnect_model_disconnected_sync
    self.Model_mock.connect_model.has_calls([mock.call('modelname'),
  File "/home/runner/work/zaza/zaza/.tox/py/lib/python3.8/site-packages/mock/mock.py", line 695, in __getattr__
    raise AttributeError(
AttributeError: 'has_calls' is not a valid assertion. Use a spec for the mock if 'has_calls' is meant to be an attribute.

Essentially, just update the asserts to be correct.