Browse Source

Fixed wrongly used assertEqual method

In several places, assertEqual is used the following way:
  assertEqual(observed, expected)
However, the correct way to use assertEqual is:
  assertEqual(expected, observed)

Change-Id: I5a7442f4adf98bf7bc73cef1d17d20da39d9a7f8
Closes-Bug: #1551861
changes/22/286722/1
Gábor Antal 5 years ago
parent
commit
c440cdd69f
40 changed files with 163 additions and 167 deletions
  1. +1
    -1
      watcher/tests/api/test_utils.py
  2. +6
    -7
      watcher/tests/api/v1/test_actions.py
  3. +1
    -1
      watcher/tests/api/v1/test_actions_plans.py
  4. +1
    -1
      watcher/tests/api/v1/test_audits.py
  5. +1
    -1
      watcher/tests/applier/actions/test_migration.py
  6. +1
    -1
      watcher/tests/applier/messaging/test_trigger_action_plan_endpoint.py
  7. +2
    -2
      watcher/tests/applier/test_applier_manager.py
  8. +8
    -8
      watcher/tests/applier/workflow_engine/test_default_workflow_engine.py
  9. +2
    -2
      watcher/tests/cmd/test_api.py
  10. +2
    -2
      watcher/tests/cmd/test_applier.py
  11. +2
    -2
      watcher/tests/cmd/test_db_manage.py
  12. +2
    -2
      watcher/tests/cmd/test_decision_engine.py
  13. +1
    -1
      watcher/tests/common/loader/test_loader.py
  14. +7
    -7
      watcher/tests/common/messaging/test_messaging_core.py
  15. +2
    -2
      watcher/tests/common/messaging/test_messaging_handler.py
  16. +5
    -5
      watcher/tests/common/test_ceilometer_helper.py
  17. +3
    -3
      watcher/tests/common/test_nova_helper.py
  18. +2
    -2
      watcher/tests/decision_engine/model/test_disk_info.py
  19. +18
    -18
      watcher/tests/decision_engine/model/test_mapping.py
  20. +5
    -5
      watcher/tests/decision_engine/model/test_model.py
  21. +2
    -2
      watcher/tests/decision_engine/model/test_named_element.py
  22. +2
    -2
      watcher/tests/decision_engine/model/test_vm.py
  23. +5
    -5
      watcher/tests/decision_engine/planner/test_default_planner.py
  24. +5
    -5
      watcher/tests/decision_engine/solution/test_default_solution.py
  25. +1
    -1
      watcher/tests/decision_engine/strategy/selector/test_strategy_selector.py
  26. +23
    -27
      watcher/tests/decision_engine/strategy/strategies/test_basic_consolidation.py
  27. +10
    -10
      watcher/tests/decision_engine/strategy/strategies/test_outlet_temp_control.py
  28. +1
    -1
      watcher/tests/objects/test_action.py
  29. +1
    -1
      watcher/tests/objects/test_action_plan.py
  30. +1
    -1
      watcher/tests/objects/test_audit.py
  31. +1
    -1
      watcher/tests/objects/test_audit_template.py
  32. +13
    -13
      watcher/tests/objects/test_objects.py
  33. +10
    -9
      watcher_tempest_plugin/tests/api/admin/test_action.py
  34. +4
    -4
      watcher_tempest_plugin/tests/api/admin/test_action_plan.py
  35. +1
    -1
      watcher_tempest_plugin/tests/api/admin/test_api_discovery.py
  36. +2
    -2
      watcher_tempest_plugin/tests/api/admin/test_audit.py
  37. +1
    -1
      watcher_tempest_plugin/tests/api/admin/test_audit_template.py
  38. +2
    -2
      watcher_tempest_plugin/tests/api/admin/test_goal.py
  39. +2
    -2
      watcher_tempest_plugin/tests/scenario/test_execute_basic_optim.py
  40. +4
    -4
      watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py

+ 1
- 1
watcher/tests/api/test_utils.py View File

@ -44,7 +44,7 @@ class TestApiUtilsValidScenarios(base.TestCase):
cfg.CONF.set_override("max_limit", self.max_limit, group="api",
enforce_type=True)
actual_limit = v1_utils.validate_limit(self.limit)
self.assertEqual(actual_limit, self.expected)
self.assertEqual(self.expected, actual_limit)
class TestApiUtilsInvalidScenarios(base.TestCase):


+ 6
- 7
watcher/tests/api/v1/test_actions.py View File

@ -310,16 +310,15 @@ class TestListAction(api_base.FunctionalTest):
self.assertEqual(len(ap2_action_list), len(response['actions']))
# We deleted them so that's normal
self.assertEqual(
[act for act in response['actions']
if act['action_plan_uuid'] == action_plan1.uuid],
[])
self.assertEqual([],
[act for act in response['actions']
if act['action_plan_uuid'] == action_plan1.uuid])
# Here are the 2 actions left
self.assertEqual(
set([act.as_dict()['uuid'] for act in ap2_action_list]),
set([act['uuid'] for act in response['actions']
if act['action_plan_uuid'] == action_plan2.uuid]),
set([act.as_dict()['uuid'] for act in ap2_action_list]))
if act['action_plan_uuid'] == action_plan2.uuid]))
def test_many_with_next_uuid(self):
action_list = []
@ -584,7 +583,7 @@ class TestDelete(api_base.FunctionalTest):
return_deleted_at = timeutils.strtime(action['deleted_at'])
self.assertEqual(timeutils.strtime(test_time), return_deleted_at)
self.assertEqual(action['state'], 'DELETED')
self.assertEqual('DELETED', action['state'])
def test_delete_action_not_found(self):
uuid = utils.generate_uuid()


+ 1
- 1
watcher/tests/api/v1/test_actions_plans.py View File

@ -334,7 +334,7 @@ class TestDelete(api_base.FunctionalTest):
self.assertTrue(ap_response.json['error_message'])
# Nor does the action
self.assertEqual(len(acts_response['actions']), 0)
self.assertEqual(0, len(acts_response['actions']))
self.assertEqual(404, act_response.status_int)
self.assertEqual('application/json', act_response.content_type)
self.assertTrue(act_response.json['error_message'])


+ 1
- 1
watcher/tests/api/v1/test_audits.py View File

@ -564,7 +564,7 @@ class TestDelete(api_base.FunctionalTest):
return_deleted_at = timeutils.strtime(audit['deleted_at'])
self.assertEqual(timeutils.strtime(test_time), return_deleted_at)
self.assertEqual(audit['state'], 'DELETED')
self.assertEqual('DELETED', audit['state'])
def test_delete_audit_not_found(self):
uuid = utils.generate_uuid()


+ 1
- 1
watcher/tests/applier/actions/test_migration.py View File

@ -152,7 +152,7 @@ class TestMigration(base.TestCase):
exc = self.assertRaises(
exception.InstanceNotFound, self.action.execute)
self.m_helper.find_instance.assert_called_once_with(self.INSTANCE_UUID)
self.assertEqual(exc.kwargs["name"], self.INSTANCE_UUID)
self.assertEqual(self.INSTANCE_UUID, exc.kwargs["name"])
def test_execute_live_migration(self):
self.m_helper.find_instance.return_value = self.INSTANCE_UUID


+ 1
- 1
watcher/tests/applier/messaging/test_trigger_action_plan_endpoint.py View File

@ -38,4 +38,4 @@ class TestTriggerActionPlan(base.TestCase):
action_plan_uuid = utils.generate_uuid()
expected_uuid = self.endpoint.launch_action_plan(self.context,
action_plan_uuid)
self.assertEqual(action_plan_uuid, expected_uuid)
self.assertEqual(expected_uuid, action_plan_uuid)

+ 2
- 2
watcher/tests/applier/test_applier_manager.py View File

@ -35,5 +35,5 @@ class TestApplierManager(base.TestCase):
def test_connect(self, m_messaging, m_thread):
self.applier.connect()
self.applier.join()
self.assertEqual(m_messaging.call_count, 2)
self.assertEqual(m_thread.call_count, 1)
self.assertEqual(2, m_messaging.call_count)
self.assertEqual(1, m_thread.call_count)

+ 8
- 8
watcher/tests/applier/workflow_engine/test_default_workflow_engine.py View File

@ -66,7 +66,7 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
def test_execute(self):
actions = mock.MagicMock()
result = self.engine.execute(actions)
self.assertEqual(result, True)
self.assertEqual(True, result)
def create_action(self, action_type, parameters, next):
action = {
@ -85,7 +85,7 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
def check_action_state(self, action, expected_state):
to_check = objects.Action.get_by_uuid(self.context, action.uuid)
self.assertEqual(to_check.state, expected_state)
self.assertEqual(expected_state, to_check.state)
def check_actions_state(self, actions, expected_state):
for a in actions:
@ -94,12 +94,12 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
def test_execute_with_no_actions(self):
actions = []
result = self.engine.execute(actions)
self.assertEqual(result, True)
self.assertEqual(True, result)
def test_execute_with_one_action(self):
actions = [self.create_action("nop", {'message': 'test'}, None)]
result = self.engine.execute(actions)
self.assertEqual(result, True)
self.assertEqual(True, result)
self.check_actions_state(actions, objects.action.State.SUCCEEDED)
def test_execute_with_two_actions(self):
@ -111,7 +111,7 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
actions.append(next)
result = self.engine.execute(actions)
self.assertEqual(result, True)
self.assertEqual(True, result)
self.check_actions_state(actions, objects.action.State.SUCCEEDED)
def test_execute_with_three_actions(self):
@ -128,7 +128,7 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
actions.append(next2)
result = self.engine.execute(actions)
self.assertEqual(result, True)
self.assertEqual(True, result)
self.check_actions_state(actions, objects.action.State.SUCCEEDED)
def test_execute_with_exception(self):
@ -145,7 +145,7 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
actions.append(next2)
result = self.engine.execute(actions)
self.assertEqual(result, False)
self.assertEqual(False, result)
self.check_action_state(first, objects.action.State.SUCCEEDED)
self.check_action_state(next, objects.action.State.SUCCEEDED)
self.check_action_state(next2, objects.action.State.FAILED)
@ -162,5 +162,5 @@ class TestDefaultWorkFlowEngine(base.DbTestCase):
namespace=FakeAction.namespace())
actions = [self.create_action("dontcare", {}, None)]
result = self.engine.execute(actions)
self.assertEqual(result, False)
self.assertEqual(False, result)
self.check_action_state(actions[0], objects.action.State.FAILED)

+ 2
- 2
watcher/tests/cmd/test_api.py View File

@ -54,7 +54,7 @@ class TestApi(BaseTestCase):
def test_run_api_app(self, m_make, m_make_app):
m_make_app.return_value = load_test_app(config=api_config.PECAN_CONFIG)
api.main()
self.assertEqual(m_make.call_count, 1)
self.assertEqual(1, m_make.call_count)
@patch("watcher.api.app.pecan.make_app")
@patch.object(BaseServer, "serve_forever", Mock())
@ -63,4 +63,4 @@ class TestApi(BaseTestCase):
cfg.CONF.set_default("host", "localhost", group="api")
m_make_app.return_value = load_test_app(config=api_config.PECAN_CONFIG)
api.main()
self.assertEqual(m_make.call_count, 1)
self.assertEqual(1, m_make.call_count)

+ 2
- 2
watcher/tests/cmd/test_applier.py View File

@ -47,5 +47,5 @@ class TestApplier(BaseTestCase):
@patch.object(ApplierManager, "join")
def test_run_applier_app(self, m_connect, m_join):
applier.main()
self.assertEqual(m_connect.call_count, 1)
self.assertEqual(m_join.call_count, 1)
self.assertEqual(1, m_connect.call_count)
self.assertEqual(1, m_join.call_count)

+ 2
- 2
watcher/tests/cmd/test_db_manage.py View File

@ -48,7 +48,7 @@ class TestDBManageRunApp(TestCase):
m_sys.argv = list(filter(None, ["watcher-db-manage", self.command]))
dbmanage.main()
self.assertEqual(m_func.call_count, 1)
self.assertEqual(1, m_func.call_count)
m_prepare_service.assert_called_once_with(
["watcher-db-manage", self.expected])
@ -97,4 +97,4 @@ class TestDBManageRunCommand(TestCase):
def test_run_db_version(self, m_version):
dbmanage.DBCommand.version()
self.assertEqual(m_version.call_count, 1)
self.assertEqual(1, m_version.call_count)

+ 2
- 2
watcher/tests/cmd/test_decision_engine.py View File

@ -49,5 +49,5 @@ class TestDecisionEngine(BaseTestCase):
@patch.object(DecisionEngineManager, "join")
def test_run_de_app(self, m_connect, m_join):
decisionengine.main()
self.assertEqual(m_connect.call_count, 1)
self.assertEqual(m_join.call_count, 1)
self.assertEqual(1, m_connect.call_count)
self.assertEqual(1, m_join.call_count)

+ 1
- 1
watcher/tests/common/loader/test_loader.py View File

@ -42,7 +42,7 @@ class TestLoader(BaseTestCase):
loader_manager = DefaultLoader(namespace='TESTING')
loaded_driver = loader_manager.load(name='fake')
self.assertEqual(loaded_driver.get_name(), FakeLoadable.get_name())
self.assertEqual(FakeLoadable.get_name(), loaded_driver.get_name())
@mock.patch("watcher.common.loader.default.DriverManager")
def test_load_driver_bad_plugin(self, m_driver_manager):


+ 7
- 7
watcher/tests/common/messaging/test_messaging_core.py View File

@ -32,13 +32,13 @@ class TestMessagingCore(base.TestCase):
def test_connect(self, m_handler):
messaging = messaging_core.MessagingCore("", "", "")
messaging.connect()
self.assertEqual(m_handler.call_count, 2)
self.assertEqual(2, m_handler.call_count)
@mock.patch.object(messaging_handler, "MessagingHandler")
def test_disconnect(self, m_handler):
messaging = messaging_core.MessagingCore("", "", "")
messaging.disconnect()
self.assertEqual(m_handler.call_count, 2)
self.assertEqual(2, m_handler.call_count)
def test_build_topic_handler(self):
topic_name = "MyTopic"
@ -102,9 +102,9 @@ class TestMessagingCore(base.TestCase):
topic = messaging.build_topic_handler("test_topic")
self.assertIsInstance(topic, messaging_handler.MessagingHandler)
self.assertEqual(messaging.publisher_id, "pub_id")
self.assertEqual(topic.publisher_id, "pub_id")
self.assertEqual("pub_id", messaging.publisher_id)
self.assertEqual("pub_id", topic.publisher_id)
self.assertEqual(
messaging.conductor_topic_handler.topic_name, "test_topic")
self.assertEqual(topic.topic_name, "test_topic")
self.assertEqual("test_topic",
messaging.conductor_topic_handler.topic_name)
self.assertEqual("test_topic", topic.topic_name)

+ 2
- 2
watcher/tests/common/messaging/test_messaging_handler.py View File

@ -70,8 +70,8 @@ class TestMessagingHandler(base.TestCase):
serializer=None,
)
self.assertEqual(handler.endpoints, [self.ENDPOINT])
self.assertEqual([self.ENDPOINT], handler.endpoints)
handler.remove_endpoint(self.ENDPOINT)
self.assertEqual(handler.endpoints, [])
self.assertEqual([], handler.endpoints)

+ 5
- 5
watcher/tests/common/test_ceilometer_helper.py View File

@ -44,7 +44,7 @@ class TestCeilometerHelper(base.BaseTestCase):
user_ids=["user_ids"],
tenant_ids=["tenant_ids"],
resource_ids=["resource_ids"])
self.assertEqual(query, expected)
self.assertEqual(expected, query)
def test_statistic_aggregation(self, mock_ceilometer):
cm = ceilometer_helper.CeilometerHelper()
@ -60,7 +60,7 @@ class TestCeilometerHelper(base.BaseTestCase):
meter_name="cpu_util",
period="7300"
)
self.assertEqual(val, expected_result)
self.assertEqual(expected_result, val)
def test_get_last_sample(self, mock_ceilometer):
ceilometer = mock.MagicMock()
@ -74,7 +74,7 @@ class TestCeilometerHelper(base.BaseTestCase):
resource_id="id",
meter_name="compute.node.percent"
)
self.assertEqual(val, expected_result)
self.assertEqual(expected_result, val)
def test_get_last_sample_none(self, mock_ceilometer):
ceilometer = mock.MagicMock()
@ -86,7 +86,7 @@ class TestCeilometerHelper(base.BaseTestCase):
resource_id="id",
meter_name="compute.node.percent"
)
self.assertEqual(val, expected)
self.assertEqual(expected, val)
def test_statistic_list(self, mock_ceilometer):
ceilometer = mock.MagicMock()
@ -95,4 +95,4 @@ class TestCeilometerHelper(base.BaseTestCase):
mock_ceilometer.return_value = ceilometer
cm = ceilometer_helper.CeilometerHelper()
val = cm.statistic_list(meter_name="cpu_util")
self.assertEqual(val, expected_value)
self.assertEqual(expected_value, val)

+ 3
- 3
watcher/tests/common/test_nova_helper.py View File

@ -51,7 +51,7 @@ class TestNovaHelper(base.TestCase):
nova_util.nova.servers.list.return_value = [server]
result = nova_util.stop_instance(instance_id)
self.assertEqual(result, True)
self.assertEqual(True, result)
def test_set_host_offline(self, mock_glance, mock_cinder, mock_neutron,
mock_nova):
@ -60,7 +60,7 @@ class TestNovaHelper(base.TestCase):
nova_util.nova.hosts = mock.MagicMock()
nova_util.nova.hosts.get.return_value = host
result = nova_util.set_host_offline("rennes")
self.assertEqual(result, True)
self.assertEqual(True, result)
@mock.patch.object(time, 'sleep', mock.Mock())
def test_live_migrate_instance(self, mock_glance, mock_cinder,
@ -85,7 +85,7 @@ class TestNovaHelper(base.TestCase):
self.instance_uuid,
self.destination_hypervisor)
self.assertEqual(is_success, False)
self.assertEqual(False, is_success)
@mock.patch.object(time, 'sleep', mock.Mock())
def test_watcher_non_live_migrate_instance_volume(


+ 2
- 2
watcher/tests/decision_engine/model/test_disk_info.py View File

@ -25,9 +25,9 @@ class TestDiskInfo(base.BaseTestCase):
def test_all(self):
disk_information = DiskInfo()
disk_information.set_size(1024)
self.assertEqual(disk_information.get_size(), 1024)
self.assertEqual(1024, disk_information.get_size())
disk_information.set_scheduler = "scheduler_qcq"
disk_information.set_device_name("nom_qcq")
self.assertEqual(disk_information.get_device_name(), "nom_qcq")
self.assertEqual("nom_qcq", disk_information.get_device_name())

+ 18
- 18
watcher/tests/decision_engine/model/test_mapping.py View File

@ -40,35 +40,35 @@ class TestMapping(base.BaseTestCase):
if vm.uuid != self.VM1_UUID:
vm = vms[keys[1]]
node = model.mapping.get_node_from_vm(vm)
self.assertEqual(node.uuid, 'Node_0')
self.assertEqual('Node_0', node.uuid)
def test_get_node_from_vm_id(self):
fake_cluster = faker_cluster_state.FakerModelCollector()
model = fake_cluster.generate_scenario_3_with_2_hypervisors()
hyps = model.mapping.get_node_vms_from_id("BLABLABLA")
self.assertEqual(hyps.__len__(), 0)
self.assertEqual(0, hyps.__len__())
def test_get_all_vms(self):
fake_cluster = faker_cluster_state.FakerModelCollector()
model = fake_cluster.generate_scenario_3_with_2_hypervisors()
vms = model.get_all_vms()
self.assertEqual(vms.__len__(), 2)
self.assertEqual(vms[self.VM1_UUID].state,
vm_state.VMState.ACTIVE.value)
self.assertEqual(vms[self.VM1_UUID].uuid, self.VM1_UUID)
self.assertEqual(vms[self.VM2_UUID].state,
vm_state.VMState.ACTIVE.value)
self.assertEqual(vms[self.VM2_UUID].uuid, self.VM2_UUID)
self.assertEqual(2, vms.__len__())
self.assertEqual(vm_state.VMState.ACTIVE.value,
vms[self.VM1_UUID].state)
self.assertEqual(self.VM1_UUID, vms[self.VM1_UUID].uuid)
self.assertEqual(vm_state.VMState.ACTIVE.value,
vms[self.VM2_UUID].state)
self.assertEqual(self.VM2_UUID, vms[self.VM2_UUID].uuid)
def test_get_mapping(self):
fake_cluster = faker_cluster_state.FakerModelCollector()
model = fake_cluster.generate_scenario_3_with_2_hypervisors()
mapping_vm = model.mapping.get_mapping_vm()
self.assertEqual(mapping_vm.__len__(), 2)
self.assertEqual(mapping_vm[self.VM1_UUID], 'Node_0')
self.assertEqual(mapping_vm[self.VM2_UUID], 'Node_1')
self.assertEqual(2, mapping_vm.__len__())
self.assertEqual('Node_0', mapping_vm[self.VM1_UUID])
self.assertEqual('Node_1', mapping_vm[self.VM2_UUID])
def test_migrate_vm(self):
fake_cluster = faker_cluster_state.FakerModelCollector()
@ -80,10 +80,10 @@ class TestMapping(base.BaseTestCase):
vm1 = vms[keys[1]]
hyp1 = model.mapping.get_node_from_vm_id(vm1.uuid)
self.assertEqual(model.mapping.migrate_vm(vm1, hyp1, hyp1), False)
self.assertEqual(model.mapping.migrate_vm(vm1, hyp0, hyp0), False)
self.assertEqual(model.mapping.migrate_vm(vm1, hyp1, hyp0), True)
self.assertEqual(model.mapping.migrate_vm(vm1, hyp0, hyp1), True)
self.assertEqual(False, model.mapping.migrate_vm(vm1, hyp1, hyp1))
self.assertEqual(False, model.mapping.migrate_vm(vm1, hyp0, hyp0))
self.assertEqual(True, model.mapping.migrate_vm(vm1, hyp1, hyp0))
self.assertEqual(True, model.mapping.migrate_vm(vm1, hyp0, hyp1))
def test_unmap_from_id_log_warning(self):
fake_cluster = faker_cluster_state.FakerModelCollector()
@ -108,5 +108,5 @@ class TestMapping(base.BaseTestCase):
hyp0 = model.mapping.get_node_from_vm_id(vm0.uuid)
model.mapping.unmap_from_id(hyp0.uuid, vm0.uuid)
self.assertEqual(len(model.mapping.get_node_vms_from_id(
hyp0.uuid)), 0)
self.assertEqual(0, len(model.mapping.get_node_vms_from_id(
hyp0.uuid)))

+ 5
- 5
watcher/tests/decision_engine/model/test_model.py View File

@ -33,9 +33,9 @@ class TestModel(base.BaseTestCase):
fake_cluster = FakerModelCollector()
model = fake_cluster.generate_scenario_1()
self.assertEqual(len(model._hypervisors), 5)
self.assertEqual(len(model._vms), 35)
self.assertEqual(len(model.get_mapping().get_mapping()), 5)
self.assertEqual(5, len(model._hypervisors))
self.assertEqual(35, len(model._vms))
self.assertEqual(5, len(model.get_mapping().get_mapping()))
def test_add_hypervisor(self):
model = ModelRoot()
@ -43,7 +43,7 @@ class TestModel(base.BaseTestCase):
hypervisor = Hypervisor()
hypervisor.uuid = id
model.add_hypervisor(hypervisor)
self.assertEqual(model.get_hypervisor_from_id(id), hypervisor)
self.assertEqual(hypervisor, model.get_hypervisor_from_id(id))
def test_delete_hypervisor(self):
model = ModelRoot()
@ -51,7 +51,7 @@ class TestModel(base.BaseTestCase):
hypervisor = Hypervisor()
hypervisor.uuid = id
model.add_hypervisor(hypervisor)
self.assertEqual(model.get_hypervisor_from_id(id), hypervisor)
self.assertEqual(hypervisor, model.get_hypervisor_from_id(id))
model.remove_hypervisor(hypervisor)
self.assertRaises(exception.HypervisorNotFound,
model.get_hypervisor_from_id, id)


+ 2
- 2
watcher/tests/decision_engine/model/test_named_element.py View File

@ -24,9 +24,9 @@ class TestNamedElement(base.BaseTestCase):
def test_namedelement(self):
id = ComputeResource()
id.uuid = "BLABLABLA"
self.assertEqual(id.uuid, "BLABLABLA")
self.assertEqual("BLABLABLA", id.uuid)
def test_set_get_human_id(self):
id = ComputeResource()
id.human_id = "BLABLABLA"
self.assertEqual(id.human_id, "BLABLABLA")
self.assertEqual("BLABLABLA", id.human_id)

+ 2
- 2
watcher/tests/decision_engine/model/test_vm.py View File

@ -25,6 +25,6 @@ class TestVm(base.BaseTestCase):
def test_namedelement(self):
vm = VM()
vm.state = VMState.ACTIVE
self.assertEqual(vm.state, VMState.ACTIVE)
self.assertEqual(VMState.ACTIVE, vm.state)
vm.human_id = "human_05"
self.assertEqual(vm.human_id, "human_05")
self.assertEqual("human_05", vm.human_id)

+ 5
- 5
watcher/tests/decision_engine/planner/test_default_planner.py View File

@ -79,10 +79,10 @@ class TestActionScheduling(base.DbTestCase):
)
self.assertIsNotNone(action_plan.uuid)
self.assertEqual(m_create_action.call_count, 1)
self.assertEqual(1, m_create_action.call_count)
filters = {'action_plan_id': action_plan.id}
actions = objects.Action.dbapi.get_action_list(self.context, filters)
self.assertEqual(actions[0].action_type, "migrate")
self.assertEqual("migrate", actions[0].action_type)
def test_schedule_two_actions(self):
default_planner = pbase.DefaultPlanner()
@ -108,12 +108,12 @@ class TestActionScheduling(base.DbTestCase):
self.context, audit.id, solution
)
self.assertIsNotNone(action_plan.uuid)
self.assertEqual(m_create_action.call_count, 2)
self.assertEqual(2, m_create_action.call_count)
# check order
filters = {'action_plan_id': action_plan.id}
actions = objects.Action.dbapi.get_action_list(self.context, filters)
self.assertEqual(actions[0].action_type, "nop")
self.assertEqual(actions[1].action_type, "migrate")
self.assertEqual("nop", actions[0].action_type)
self.assertEqual("migrate", actions[1].action_type)
class TestDefaultPlanner(base.DbTestCase):


+ 5
- 5
watcher/tests/decision_engine/solution/test_default_solution.py View File

@ -28,14 +28,14 @@ class TestDefaultSolution(base.BaseTestCase):
solution.add_action(action_type="nop",
resource_id="b199db0c-1408-4d52-b5a5-5ca14de0ff36",
input_parameters=parameters)
self.assertEqual(len(solution.actions), 1)
self.assertEqual(1, len(solution.actions))
expected_action_type = "nop"
expected_parameters = {
"src_uuid_hypervisor": "server1",
"dst_uuid_hypervisor": "server2",
"resource_id": "b199db0c-1408-4d52-b5a5-5ca14de0ff36"
}
self.assertEqual(solution.actions[0].get('action_type'),
expected_action_type)
self.assertEqual(solution.actions[0].get('input_parameters'),
expected_parameters)
self.assertEqual(expected_action_type,
solution.actions[0].get('action_type'))
self.assertEqual(expected_parameters,
solution.actions[0].get('input_parameters'))

+ 1
- 1
watcher/tests/decision_engine/strategy/selector/test_strategy_selector.py View File

@ -46,4 +46,4 @@ class TestStrategySelector(TestCase):
self.assertRaises(WatcherException,
self.strategy_selector.define_from_goal,
"DUMMY")
self.assertEqual(mock_call.call_count, 0)
self.assertEqual(0, mock_call.call_count)

+ 23
- 27
watcher/tests/decision_engine/strategy/strategies/test_basic_consolidation.py View File

@ -41,7 +41,7 @@ class TestBasicConsolidation(base.BaseTestCase):
size_cluster = len(
self.fake_cluster.generate_scenario_1().get_all_hypervisors())
size_cluster_assert = 5
self.assertEqual(size_cluster, size_cluster_assert)
self.assertEqual(size_cluster_assert, size_cluster)
def test_basic_consolidation_score_hypervisor(self):
cluster = self.fake_cluster.generate_scenario_1()
@ -50,20 +50,17 @@ class TestBasicConsolidation(base.BaseTestCase):
statistic_aggregation=self.fake_metrics.mock_get_statistics)
node_1_score = 0.023333333333333317
self.assertEqual(
sercon.calculate_score_node(
cluster.get_hypervisor_from_id("Node_1"),
cluster), node_1_score)
self.assertEqual(node_1_score, sercon.calculate_score_node(
cluster.get_hypervisor_from_id("Node_1"),
cluster))
node_2_score = 0.26666666666666666
self.assertEqual(
sercon.calculate_score_node(
cluster.get_hypervisor_from_id("Node_2"),
cluster), node_2_score)
self.assertEqual(node_2_score, sercon.calculate_score_node(
cluster.get_hypervisor_from_id("Node_2"),
cluster))
node_0_score = 0.023333333333333317
self.assertEqual(
sercon.calculate_score_node(
cluster.get_hypervisor_from_id("Node_0"),
cluster), node_0_score)
self.assertEqual(node_0_score, sercon.calculate_score_node(
cluster.get_hypervisor_from_id("Node_0"),
cluster))
def test_basic_consolidation_score_vm(self):
cluster = self.fake_cluster.generate_scenario_1()
@ -72,21 +69,20 @@ class TestBasicConsolidation(base.BaseTestCase):
statistic_aggregation=self.fake_metrics.mock_get_statistics)
vm_0 = cluster.get_vm_from_id("VM_0")
vm_0_score = 0.023333333333333317
self.assertEqual(sercon.calculate_score_vm(vm_0, cluster), vm_0_score)
self.assertEqual(vm_0_score, sercon.calculate_score_vm(vm_0, cluster))
vm_1 = cluster.get_vm_from_id("VM_1")
vm_1_score = 0.023333333333333317
self.assertEqual(sercon.calculate_score_vm(vm_1, cluster),
vm_1_score)
self.assertEqual(vm_1_score, sercon.calculate_score_vm(vm_1, cluster))
vm_2 = cluster.get_vm_from_id("VM_2")
vm_2_score = 0.033333333333333326
self.assertEqual(sercon.calculate_score_vm(vm_2, cluster), vm_2_score)
self.assertEqual(vm_2_score, sercon.calculate_score_vm(vm_2, cluster))
vm_6 = cluster.get_vm_from_id("VM_6")
vm_6_score = 0.02666666666666669
self.assertEqual(sercon.calculate_score_vm(vm_6, cluster), vm_6_score)
self.assertEqual(vm_6_score, sercon.calculate_score_vm(vm_6, cluster))
vm_7 = cluster.get_vm_from_id("VM_7")
vm_7_score = 0.013333333333333345
self.assertEqual(sercon.calculate_score_vm(vm_7, cluster), vm_7_score)
self.assertEqual(vm_7_score, sercon.calculate_score_vm(vm_7, cluster))
def test_basic_consolidation_score_vm_disk(self):
cluster = self.fake_cluster.generate_scenario_5_with_vm_disk_0()
@ -95,7 +91,7 @@ class TestBasicConsolidation(base.BaseTestCase):
statistic_aggregation=self.fake_metrics.mock_get_statistics)
vm_0 = cluster.get_vm_from_id("VM_0")
vm_0_score = 0.023333333333333355
self.assertEqual(sercon.calculate_score_vm(vm_0, cluster), vm_0_score)
self.assertEqual(vm_0_score, sercon.calculate_score_vm(vm_0, cluster))
def test_basic_consolidation_weight(self):
cluster = self.fake_cluster.generate_scenario_1()
@ -109,9 +105,9 @@ class TestBasicConsolidation(base.BaseTestCase):
# mem 8 Go
mem = 8
vm_0_weight_assert = 3.1999999999999997
self.assertEqual(sercon.calculate_weight(cluster, vm_0, cores, disk,
mem),
vm_0_weight_assert)
self.assertEqual(vm_0_weight_assert,
sercon.calculate_weight(cluster, vm_0, cores, disk,
mem))
def test_calculate_migration_efficacy(self):
sercon = strategies.BasicConsolidation()
@ -162,7 +158,7 @@ class TestBasicConsolidation(base.BaseTestCase):
threshold_cores = sercon.get_threshold_cores()
sercon.set_threshold_cores(threshold_cores + 1)
self.assertEqual(sercon.get_threshold_cores(), threshold_cores + 1)
self.assertEqual(threshold_cores + 1, sercon.get_threshold_cores())
def test_number_of(self):
sercon = strategies.BasicConsolidation()
@ -186,8 +182,8 @@ class TestBasicConsolidation(base.BaseTestCase):
num_migrations = actions_counter.get("migrate", 0)
num_hypervisor_state_change = actions_counter.get(
"change_hypervisor_state", 0)
self.assertEqual(num_migrations, expected_num_migrations)
self.assertEqual(num_hypervisor_state_change, expected_power_state)
self.assertEqual(expected_num_migrations, num_migrations)
self.assertEqual(expected_power_state, num_hypervisor_state_change)
# calculate_weight
def test_execute_no_workload(self):
@ -204,7 +200,7 @@ class TestBasicConsolidation(base.BaseTestCase):
as mock_score_call:
mock_score_call.return_value = 0
solution = sercon.execute(model)
self.assertEqual(solution.efficacy, 100)
self.assertEqual(100, solution.efficacy)
def test_check_parameters(self):
sercon = strategies.BasicConsolidation()


+ 10
- 10
watcher/tests/decision_engine/strategy/strategies/test_outlet_temp_control.py View File

@ -51,7 +51,7 @@ class TestOutletTempControl(base.BaseTestCase):
cap_mem,
cap_disk)
self.assertEqual((cores_used, mem_used, disk_used), (10, 2, 20))
self.assertEqual((10, 2, 20), (cores_used, mem_used, disk_used))
def test_group_hosts_by_outlet_temp(self):
model = self.fake_cluster.generate_scenario_3_with_2_hypervisors()
@ -59,8 +59,8 @@ class TestOutletTempControl(base.BaseTestCase):
strategy.ceilometer = mock.MagicMock(
statistic_aggregation=self.fake_metrics.mock_get_statistics)
h1, h2 = strategy.group_hosts_by_outlet_temp(model)
self.assertEqual(h1[0]['hv'].uuid, 'Node_1')
self.assertEqual(h2[0]['hv'].uuid, 'Node_0')
self.assertEqual('Node_1', h1[0]['hv'].uuid)
self.assertEqual('Node_0', h2[0]['hv'].uuid)
def test_choose_vm_to_migrate(self):
model = self.fake_cluster.generate_scenario_3_with_2_hypervisors()
@ -69,9 +69,9 @@ class TestOutletTempControl(base.BaseTestCase):
statistic_aggregation=self.fake_metrics.mock_get_statistics)
h1, h2 = strategy.group_hosts_by_outlet_temp(model)
vm_to_mig = strategy.choose_vm_to_migrate(model, h1)
self.assertEqual(vm_to_mig[0].uuid, 'Node_1')
self.assertEqual(vm_to_mig[1].uuid,
"a4cab39b-9828-413a-bf88-f76921bf1517")
self.assertEqual('Node_1', vm_to_mig[0].uuid)
self.assertEqual('a4cab39b-9828-413a-bf88-f76921bf1517',
vm_to_mig[1].uuid)
def test_filter_dest_servers(self):
model = self.fake_cluster.generate_scenario_3_with_2_hypervisors()
@ -81,8 +81,8 @@ class TestOutletTempControl(base.BaseTestCase):
h1, h2 = strategy.group_hosts_by_outlet_temp(model)
vm_to_mig = strategy.choose_vm_to_migrate(model, h1)
dest_hosts = strategy.filter_dest_servers(model, h2, vm_to_mig[1])
self.assertEqual(len(dest_hosts), 1)
self.assertEqual(dest_hosts[0]['hv'].uuid, 'Node_0')
self.assertEqual(1, len(dest_hosts))
self.assertEqual('Node_0', dest_hosts[0]['hv'].uuid)
def test_exception_model(self):
strategy = strategies.OutletTempControl()
@ -111,7 +111,7 @@ class TestOutletTempControl(base.BaseTestCase):
generate_scenario_4_with_1_hypervisor_no_vm()
solution = strategy.execute(model)
self.assertEqual(solution.actions, [])
self.assertEqual([], solution.actions)
def test_execute(self):
strategy = strategies.OutletTempControl()
@ -123,7 +123,7 @@ class TestOutletTempControl(base.BaseTestCase):
[action.get('action_type') for action in solution.actions])
num_migrations = actions_counter.get("migrate", 0)
self.assertEqual(num_migrations, 1)
self.assertEqual(1, num_migrations)
def test_check_parameters(self):
outlet = strategies.OutletTempControl()


+ 1
- 1
watcher/tests/objects/test_action.py View File

@ -57,7 +57,7 @@ class TestActionObject(base.DbTestCase):
autospec=True) as mock_get_list:
mock_get_list.return_value = [self.fake_action]
actions = objects.Action.list(self.context)
self.assertEqual(mock_get_list.call_count, 1)
self.assertEqual(1, mock_get_list.call_count)
self.assertThat(actions, HasLength(1))
self.assertIsInstance(actions[0], objects.Action)
self.assertEqual(self.context, actions[0]._context)


+ 1
- 1
watcher/tests/objects/test_action_plan.py View File

@ -57,7 +57,7 @@ class TestActionPlanObject(base.DbTestCase):
autospec=True) as mock_get_list:
mock_get_list.return_value = [self.fake_action_plan]
action_plans = objects.ActionPlan.list(self.context)
self.assertEqual(mock_get_list.call_count, 1)
self.assertEqual(1, mock_get_list.call_count)
self.assertThat(action_plans, HasLength(1))
self.assertIsInstance(action_plans[0], objects.ActionPlan)
self.assertEqual(self.context, action_plans[0]._context)


+ 1
- 1
watcher/tests/objects/test_audit.py View File

@ -57,7 +57,7 @@ class TestAuditObject(base.DbTestCase):
autospec=True) as mock_get_list:
mock_get_list.return_value = [self.fake_audit]
audits = objects.Audit.list(self.context)
self.assertEqual(mock_get_list.call_count, 1)
self.assertEqual(1, mock_get_list.call_count, 1)
self.assertThat(audits, HasLength(1))
self.assertIsInstance(audits[0], objects.Audit)
self.assertEqual(self.context, audits[0]._context)


+ 1
- 1
watcher/tests/objects/test_audit_template.py View File

@ -70,7 +70,7 @@ class TestAuditTemplateObject(base.DbTestCase):
autospec=True) as mock_get_list:
mock_get_list.return_value = [self.fake_audit_template]
audit_templates = objects.AuditTemplate.list(self.context)
self.assertEqual(mock_get_list.call_count, 1)
self.assertEqual(1, mock_get_list.call_count)
self.assertThat(audit_templates, HasLength(1))
self.assertIsInstance(audit_templates[0], objects.AuditTemplate)
self.assertEqual(self.context, audit_templates[0]._context)


+ 13
- 13
watcher/tests/objects/test_objects.py View File

@ -118,39 +118,39 @@ class TestUtils(test_base.TestCase):
def test_datetime_or_none(self):
naive_dt = datetime.datetime.now()
dt = timeutils.parse_isotime(timeutils.isotime(naive_dt))
self.assertEqual(utils.datetime_or_none(dt), dt)
self.assertEqual(utils.datetime_or_none(dt),
naive_dt.replace(tzinfo=iso8601.iso8601.Utc(),
microsecond=0))
self.assertEqual(dt, utils.datetime_or_none(dt))
self.assertEqual(naive_dt.replace(tzinfo=iso8601.iso8601.Utc(),
microsecond=0),
utils.datetime_or_none(dt))
self.assertIsNone(utils.datetime_or_none(None))
self.assertRaises(ValueError, utils.datetime_or_none, 'foo')
def test_datetime_or_str_or_none(self):
dts = timeutils.isotime()
dt = timeutils.parse_isotime(dts)
self.assertEqual(utils.datetime_or_str_or_none(dt), dt)
self.assertEqual(dt, utils.datetime_or_str_or_none(dt))
self.assertIsNone(utils.datetime_or_str_or_none(None))
self.assertEqual(utils.datetime_or_str_or_none(dts), dt)
self.assertEqual(dt, utils.datetime_or_str_or_none(dts))
self.assertRaises(ValueError, utils.datetime_or_str_or_none, 'foo')
def test_int_or_none(self):
self.assertEqual(utils.int_or_none(1), 1)
self.assertEqual(utils.int_or_none('1'), 1)
self.assertEqual(1, utils.int_or_none(1))
self.assertEqual(1, utils.int_or_none('1'))
self.assertIsNone(utils.int_or_none(None))
self.assertRaises(ValueError, utils.int_or_none, 'foo')
def test_str_or_none(self):
class Obj(object):
pass
self.assertEqual(utils.str_or_none('foo'), 'foo')
self.assertEqual(utils.str_or_none(1), '1')
self.assertEqual('foo', utils.str_or_none('foo'))
self.assertEqual('1', utils.str_or_none(1))
self.assertIsNone(utils.str_or_none(None))
def test_ip_or_none(self):
ip4 = netaddr.IPAddress('1.2.3.4', 4)
ip6 = netaddr.IPAddress('1::2', 6)
self.assertEqual(utils.ip_or_none(4)('1.2.3.4'), ip4)
self.assertEqual(utils.ip_or_none(6)('1::2'), ip6)
self.assertEqual(ip4, utils.ip_or_none(4)('1.2.3.4'))
self.assertEqual(ip6, utils.ip_or_none(6)('1::2'))
self.assertIsNone(utils.ip_or_none(4)(None))
self.assertIsNone(utils.ip_or_none(6)(None))
self.assertRaises(netaddr.AddrFormatError, utils.ip_or_none(4), 'foo')
@ -170,7 +170,7 @@ class TestUtils(test_base.TestCase):
def test_dt_deserializer(self):
dt = timeutils.parse_isotime('1955-11-05T00:00:00Z')
self.assertEqual(utils.dt_deserializer(timeutils.isotime(dt)), dt)
self.assertEqual(dt, utils.dt_deserializer(timeutils.isotime(dt)))
self.assertIsNone(utils.dt_deserializer(None))
self.assertRaises(ValueError, utils.dt_deserializer, 'foo')


+ 10
- 9
watcher_tempest_plugin/tests/api/admin/test_action.py View File

@ -47,9 +47,10 @@ class TestShowListAction(base.BaseInfraOptimTest):
_, action = self.client.show_action(
self.action_plan["first_action_uuid"])
self.assertEqual(action['uuid'], self.action_plan["first_action_uuid"])
self.assertEqual(action['action_type'], "nop")
self.assertEqual(action['state'], "PENDING")
self.assertEqual(self.action_plan["first_action_uuid"],
action['uuid'])
self.assertEqual("nop", action['action_type'])
self.assertEqual("PENDING", action['state'])
@test.attr(type='smoke')
def test_show_action_with_links(self):
@ -81,9 +82,9 @@ class TestShowListAction(base.BaseInfraOptimTest):
act['action_type'] for act in body['actions'])
# A dummy strategy generates 2 "nop" actions and 1 "sleep" action
self.assertEqual(len(body['actions']), 3)
self.assertEqual(action_counter.get("nop"), 2)
self.assertEqual(action_counter.get("sleep"), 1)
self.assertEqual(3, len(body['actions']))
self.assertEqual(2, action_counter.get("nop"))
self.assertEqual(1, action_counter.get("sleep"))
@test.attr(type="smoke")
def test_list_actions_by_audit(self):
@ -97,6 +98,6 @@ class TestShowListAction(base.BaseInfraOptimTest):
act['action_type'] for act in body['actions'])
# A dummy strategy generates 2 "nop" actions and 1 "sleep" action
self.assertEqual(len(body['actions']), 3)
self.assertEqual(action_counter.get("nop"), 2)
self.assertEqual(action_counter.get("sleep"), 1)
self.assertEqual(3, len(body['actions']))
self.assertEqual(2, action_counter.get("nop"))
self.assertEqual(1, action_counter.get("sleep"))

+ 4
- 4
watcher_tempest_plugin/tests/api/admin/test_action_plan.py View File

@ -43,8 +43,8 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
_, action_plan = self.client.show_action_plan(action_plan['uuid'])
self.assertEqual(action_plan['audit_uuid'], audit['uuid'])
self.assertEqual(action_plan['state'], 'RECOMMENDED')
self.assertEqual(audit['uuid'], action_plan['audit_uuid'])
self.assertEqual('RECOMMENDED', action_plan['state'])
@test.attr(type='smoke')
def test_delete_action_plan(self):
@ -98,7 +98,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
_, finished_ap = self.client.show_action_plan(action_plan['uuid'])
self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING'))
self.assertEqual(finished_ap['state'], 'SUCCEEDED')
self.assertEqual('SUCCEEDED', finished_ap['state'])
class TestShowListActionPlan(base.BaseInfraOptimTest):
@ -164,5 +164,5 @@ class TestShowListActionPlan(base.BaseInfraOptimTest):
next_marker = body['action_plans'][-1]['uuid']
self.assertEqual(len(body['action_plans']), 3)
self.assertEqual(3, len(body['action_plans']))
self.assertIn(next_marker, body['next'])

+ 1
- 1
watcher_tempest_plugin/tests/api/admin/test_api_discovery.py View File

@ -35,7 +35,7 @@ class TestApiDiscovery(base.BaseInfraOptimTest):
def test_default_version(self):
_, descr = self.client.get_api_description()
default_version = descr['default_version']
self.assertEqual(default_version['id'], 'v1')
self.assertEqual('v1', default_version['id'])
@test.attr(type='smoke')
def test_version_1_resources(self):


+ 2
- 2
watcher_tempest_plugin/tests/api/admin/test_audit.py View File

@ -101,7 +101,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
_, audit = self.client.show_audit(body['uuid'])
initial_audit_state = audit.pop('state')
self.assertEqual(initial_audit_state, 'PENDING')
self.assertEqual('PENDING', initial_audit_state)
self.assert_expected(audit, body)
@ -176,7 +176,7 @@ class TestShowListAudit(base.BaseInfraOptimTest):
_, body = self.client.list_audits(limit=3)
next_marker = body['audits'][-1]['uuid']
self.assertEqual(len(body['audits']), 3)
self.assertEqual(3, len(body['audits']))
self.assertIn(next_marker, body['next'])
@test.attr(type='smoke')


+ 1
- 1
watcher_tempest_plugin/tests/api/admin/test_audit_template.py View File

@ -121,7 +121,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
_, body = self.client.list_audit_templates(limit=3)
next_marker = body['audit_templates'][-1]['uuid']
self.assertEqual(len(body['audit_templates']), 3)
self.assertEqual(3, len(body['audit_templates']))
self.assertIn(next_marker, body['next'])
@test.attr(type='smoke')


+ 2
- 2
watcher_tempest_plugin/tests/api/admin/test_goal.py View File

@ -39,8 +39,8 @@ class TestShowListGoal(base.BaseInfraOptimTest):
def test_show_goal(self):
_, goal = self.client.show_goal(self.DUMMY_GOAL)
self.assertEqual(goal['name'], self.DUMMY_GOAL)
self.assertEqual(goal['strategy'], "dummy")
self.assertEqual(self.DUMMY_GOAL, goal['name'])
self.assertEqual("dummy", goal['strategy'])
@test.attr(type='smoke')
def test_show_goal_with_links(self):


+ 2
- 2
watcher_tempest_plugin/tests/scenario/test_execute_basic_optim.py View File

@ -140,7 +140,7 @@ class TestExecuteBasicStrategy(base.BaseInfraOptimScenarioTest):
action_plan_uuid=finished_ap["uuid"])
self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING'))
self.assertEqual(finished_ap['state'], 'SUCCEEDED')
self.assertEqual('SUCCEEDED', finished_ap['state'])
for action in action_list['actions']:
self.assertEqual(action.get('state'), 'SUCCEEDED')
self.assertEqual('SUCCEEDED', action.get('state'))

+ 4
- 4
watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py View File

@ -71,9 +71,9 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest):
act['action_type'] for act in action_list['actions'])
self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING'))
self.assertEqual(finished_ap['state'], 'SUCCEEDED')
self.assertEqual('SUCCEEDED', finished_ap['state'])
# A dummy strategy generates 2 "nop" actions and 1 "sleep" action
self.assertEqual(len(action_list['actions']), 3)
self.assertEqual(action_counter.get("nop"), 2)
self.assertEqual(action_counter.get("sleep"), 1)
self.assertEqual(3, len(action_list['actions']))
self.assertEqual(2, action_counter.get("nop"))
self.assertEqual(1, action_counter.get("sleep"))

Loading…
Cancel
Save