def setUp(self):
        self.clients = DotDict()

        self.rr = Mock()
        self.RR2 = EnhancedResourceRegistryClient(self.rr)

        self.clients.resource_registry = self.rr

        self.policy = ResourceLCSPolicy(self.clients)
示例#2
0
class TestResourceLCSPolicy(PyonTestCase):
    def setUp(self):
        self.clients = DotDict()

        self.rr = Mock()
        self.RR2 = EnhancedResourceRegistryClient(self.rr)

        self.clients.resource_registry = self.rr

        self.policy = ResourceLCSPolicy(self.clients)

    def test_events(self):
        self.rr.read.return_value = Mock()

        #if True: self.fail("%s" % LCE.keys())
        for event in LCE.values():
            self.rr.reset_mock()
            success, msg = self.policy.check_lcs_precondition_satisfied(
                "rsrc_id", event)
            self.assertTrue(success)
            self.assertEqual("ResourceLCSPolicy base class not overridden!",
                             msg)
class TestResourceLCSPolicy(PyonTestCase):

    def setUp(self):
        self.clients = DotDict()

        self.rr = Mock()
        self.RR2 = EnhancedResourceRegistryClient(self.rr)

        self.clients.resource_registry = self.rr

        self.policy = ResourceLCSPolicy(self.clients)



    def test_events(self):
        self.rr.read.return_value = "this is a resource"

        #if True: self.fail("%s" % LCE.keys())
        for event in LCE.values():
            self.rr.reset_mock()
            success, msg = self.policy.check_lcs_precondition_satisfied("rsrc_id", event)
            self.assertTrue(success)
            self.assertEqual("ResourceLCSPolicy base class not overridden!", msg)