From 899e1a4baa95d0bc6f0eef34de66f0e257174878 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Tue, 12 Nov 2019 12:54:20 -0500 Subject: Begin Resource Refactor Begins the Resource Refactor by creating new interfaces to the resources through a Resource super class and using that new interface in the api Change-Id: I15a8179bfe915d2cde6d658d056e11cbd2c70e43 Signed-off-by: Parker Berberian --- src/api/tests/test_models_unittest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/api/tests') diff --git a/src/api/tests/test_models_unittest.py b/src/api/tests/test_models_unittest.py index e6f97a6..2ecbe42 100644 --- a/src/api/tests/test_models_unittest.py +++ b/src/api/tests/test_models_unittest.py @@ -1,4 +1,3 @@ -############################################################################## # Copyright (c) 2019 Sawyer Bergeron, Parker Berberian, and others. # # All rights reserved. This program and the accompanying materials @@ -21,6 +20,7 @@ from api.models import ( from resource_inventory.models import ( OPNFVRole, HostProfile, + ConfigState, ) from django.test import TestCase, Client @@ -201,7 +201,7 @@ class ValidBookingCreatesValidJob(TestCase): self.assertEqual(relation.status, JobStatus.NEW) config = relation.config host = relation.host - self.assertEqual(config.hostname, host.template.resource.name) + self.assertEqual(config.get_delta()["hostname"], host.template.resource.name) def test_complete_job_makes_software_configs(self): JobFactory.makeCompleteJob(self.booking) @@ -261,9 +261,10 @@ class ValidBookingCreatesValidJob(TestCase): host_set.remove(relation.host.id) except KeyError: self.fail("Hardware Relation/Config not created for host " + str(relation.host)) - - self.assertEqual(relation.config.power, "on") - self.assertTrue(relation.config.ipmi_create) + # TODO: ConfigState needs to be fixed in factory methods + relation.config.state = ConfigState.NEW + self.assertEqual(relation.config.get_delta()["power"], "on") + self.assertTrue(relation.config.get_delta()["ipmi_create"]) # TODO: the rest of hwconf attrs self.assertEqual(len(host_set), 0) -- cgit 1.2.3-korg