예제 #1
0
    def test_resource_class_delete(self):
        rc = self.tuskarclient_resource_classes.first()

        tuskarclient = self.stub_tuskarclient()
        tuskarclient.resource_classes = self.mox.CreateMockAnything()
        tuskarclient.resource_classes.delete(rc.id)
        self.mox.ReplayAll()

        ResourceClass.delete(self.request, rc.id)
예제 #2
0
    def test_resource_class_get(self):
        rc = self.tuskarclient_resource_classes.first()

        tuskarclient = self.stub_tuskarclient()
        tuskarclient.resource_classes = self.mox.CreateMockAnything()
        tuskarclient.resource_classes.get(rc.id).AndReturn(rc)
        self.mox.ReplayAll()

        ret_val = ResourceClass.get(self.request, rc.id)
        self.assertIsInstance(ret_val, ResourceClass)
예제 #3
0
    def test_resource_class_list(self):
        rcs = self.tuskarclient_resource_classes.list()

        tuskarclient = self.stub_tuskarclient()
        tuskarclient.resource_classes = self.mox.CreateMockAnything()
        tuskarclient.resource_classes.list().AndReturn(rcs)
        self.mox.ReplayAll()

        ret_val = ResourceClass.list(self.request)
        for rc in ret_val:
            self.assertIsInstance(rc, ResourceClass)
예제 #4
0
    def test_resource_class_create(self):
        rc = self.tuskarclient_resource_classes.first()

        tuskarclient = self.stub_tuskarclient()
        tuskarclient.resource_classes = self.mox.CreateMockAnything()
        tuskarclient.resource_classes.create(name='rclass1',
                                             service_type='compute',
                                             flavors=[]).AndReturn(rc)
        self.mox.ReplayAll()

        ret_val = ResourceClass.create(self.request,
                                                  name='rclass1',
                                                  service_type='compute',
                                                  flavors=[])
        self.assertIsInstance(ret_val, ResourceClass)