Merge "Use assertIn and assertNotIn"
This commit is contained in:
commit
f9536f6b2b
ironic_python_agent/tests/unit
@ -469,7 +469,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertEqual(image_info['id'],
|
||||
self.agent_extension.cached_image_id)
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('cache_image: image ({0}) cached to device '
|
||||
'{1} ').format(image_info['id'], 'manager')
|
||||
self.assertEqual(cmd_result, async_result.command_result['result'])
|
||||
@ -494,7 +494,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertEqual(image_info['id'],
|
||||
self.agent_extension.cached_image_id)
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('cache_image: image ({0}) cached to device {1} '
|
||||
'root_uuid={2}').format(image_info['id'], 'manager',
|
||||
'root_uuid')
|
||||
@ -523,7 +523,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertEqual(image_info['id'],
|
||||
self.agent_extension.cached_image_id)
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('cache_image: image ({0}) cached to device '
|
||||
'{1} ').format(image_info['id'], 'manager')
|
||||
self.assertEqual(cmd_result, async_result.command_result['result'])
|
||||
@ -549,7 +549,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertEqual(image_info['id'],
|
||||
self.agent_extension.cached_image_id)
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('cache_image: image ({0}) already present on device '
|
||||
'{1} ').format(image_info['id'], 'manager')
|
||||
self.assertEqual(cmd_result, async_result.command_result['result'])
|
||||
@ -591,7 +591,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
'manager')
|
||||
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('prepare_image: image ({0}) written to device '
|
||||
'{1} ').format(image_info['id'], 'manager')
|
||||
self.assertEqual(cmd_result, async_result.command_result['result'])
|
||||
@ -612,7 +612,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
'manager')
|
||||
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('prepare_image: image ({0}) written to device '
|
||||
'{1} ').format(image_info['id'], 'manager')
|
||||
self.assertEqual(cmd_result, async_result.command_result['result'])
|
||||
@ -653,7 +653,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertFalse(configdrive_copy_mock.called)
|
||||
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('prepare_image: image ({0}) written to device {1} '
|
||||
'root_uuid={2}').format(
|
||||
image_info['id'], 'manager', 'root_uuid')
|
||||
@ -674,7 +674,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertFalse(configdrive_copy_mock.called)
|
||||
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('prepare_image: image ({0}) written to device {1} '
|
||||
'root_uuid={2}').format(
|
||||
image_info['id'], 'manager', 'root_uuid')
|
||||
@ -712,7 +712,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
|
||||
self.assertEqual(0, configdrive_copy_mock.call_count)
|
||||
self.assertEqual('SUCCEEDED', async_result.command_status)
|
||||
self.assertTrue('result' in async_result.command_result.keys())
|
||||
self.assertIn('result', async_result.command_result)
|
||||
cmd_result = ('prepare_image: image ({0}) written to device '
|
||||
'{1} ').format(image_info['id'], 'manager')
|
||||
self.assertEqual(cmd_result, async_result.command_result['result'])
|
||||
|
@ -161,8 +161,8 @@ class TestIronicAPI(test_base.BaseTestCase):
|
||||
def test_v1_root(self):
|
||||
response = self.get_json('/v1', path_prefix='')
|
||||
data = response.json
|
||||
self.assertTrue('status' in data.keys())
|
||||
self.assertTrue('commands' in data.keys())
|
||||
self.assertIn('status', data)
|
||||
self.assertIn('commands', data)
|
||||
|
||||
def test_get_agent_status(self):
|
||||
status = agent.IronicPythonAgentStatus(time.time(),
|
||||
@ -264,9 +264,9 @@ class TestIronicAPI(test_base.BaseTestCase):
|
||||
self.assertEqual(400, response.status_code)
|
||||
data = response.json
|
||||
msg = 'Invalid input for field/attribute name.'
|
||||
self.assertTrue(msg in data['faultstring'])
|
||||
self.assertIn(msg, data['faultstring'])
|
||||
msg = 'Mandatory field missing'
|
||||
self.assertTrue(msg in data['faultstring'])
|
||||
self.assertIn(msg, data['faultstring'])
|
||||
|
||||
def test_execute_agent_command_params_validation(self):
|
||||
invalid_command = {'name': 'do_things', 'params': []}
|
||||
@ -277,7 +277,7 @@ class TestIronicAPI(test_base.BaseTestCase):
|
||||
data = response.json
|
||||
# this message is actually much longer, but I'm ok with this
|
||||
msg = 'Invalid input for field/attribute params.'
|
||||
self.assertTrue(msg in data['faultstring'])
|
||||
self.assertIn(msg, data['faultstring'])
|
||||
|
||||
def test_list_command_results(self):
|
||||
cmd_result = base.SyncCommandResult(u'do_things',
|
||||
|
@ -146,7 +146,7 @@ class GetAgentParamsTestCase(test_base.BaseTestCase):
|
||||
read_mock.assert_called_once_with()
|
||||
self.assertEqual('http://localhost:9999', params['api-url'])
|
||||
self.assertEqual('bar', params['foo'])
|
||||
self.assertFalse('baz' in params)
|
||||
self.assertNotIn('baz', params)
|
||||
|
||||
@mock.patch.object(utils, '_set_cached_params')
|
||||
@mock.patch.object(utils, '_read_params_from_file')
|
||||
|
Loading…
x
Reference in New Issue
Block a user