mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Fixed use of assert_has_calls in tests.
The method logic was changed in mock-1.1.0. This mades the use of the method compatible with both <1.1.0 and >=1.1.0
This commit is contained in:
parent
46e4bb58e5
commit
04b1a4a9ca
@ -48,7 +48,7 @@ class LoadAuthTestCase(TestCase):
|
||||
'eauth': 'pam'
|
||||
}, expected_extra_kws=auth.AUTH_INTERNAL_KEYWORDS)
|
||||
ret = self.lauth.load_name(valid_eauth_load)
|
||||
format_call_mock.assert_has_calls((expected_ret,))
|
||||
format_call_mock.assert_has_calls((expected_ret,), any_order=True)
|
||||
|
||||
def test_get_groups(self):
|
||||
valid_eauth_load = {'username': 'test_user',
|
||||
@ -63,7 +63,7 @@ class LoadAuthTestCase(TestCase):
|
||||
'eauth': 'pam'
|
||||
}, expected_extra_kws=auth.AUTH_INTERNAL_KEYWORDS)
|
||||
self.lauth.get_groups(valid_eauth_load)
|
||||
format_call_mock.assert_has_calls((expected_ret,))
|
||||
format_call_mock.assert_has_calls((expected_ret,), any_order=True)
|
||||
|
||||
|
||||
@patch('zmq.Context', MagicMock())
|
||||
|
@ -577,7 +577,7 @@ class PsTestCase(TestCase):
|
||||
'# Lines below here are managed by Salt, do not edit\n',
|
||||
'@hourly echo Hi!\n'])
|
||||
ret = cron.set_special('DUMMY_USER', '@hourly', 'echo Hi!')
|
||||
write_cron_lines_mock.assert_has_calls(expected_write_call)
|
||||
write_cron_lines_mock.assert_has_calls((expected_write_call,), any_order=True)
|
||||
|
||||
def test__get_cron_date_time(self):
|
||||
ret = cron._get_cron_date_time(minute=STUB_CRON_TIMESTAMP['minute'],
|
||||
|
@ -293,10 +293,10 @@ class MySQLTestCase(TestCase):
|
||||
with patch.dict(mysql.__salt__, {'config.option': MagicMock()}):
|
||||
function(*args, **kwargs)
|
||||
if isinstance(expected_sql, dict):
|
||||
calls = (call().cursor().execute('{0}'.format(expected_sql['sql']), expected_sql['sql_args']))
|
||||
calls = call().cursor().execute('{0}'.format(expected_sql['sql']), expected_sql['sql_args'])
|
||||
else:
|
||||
calls = (call().cursor().execute('{0}'.format(expected_sql)))
|
||||
connect_mock.assert_has_calls(calls)
|
||||
calls = call().cursor().execute('{0}'.format(expected_sql))
|
||||
connect_mock.assert_has_calls((calls,), True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user