Skip to content

Commit

Permalink
fixed up ut a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
UnDarkle committed Oct 16, 2018
1 parent 65b7953 commit 20530e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/rotest/management/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from models import ResourceData
from base_resource import BaseResource
from models import ResourceData, DataPointer
from client.manager import ClientResourceManager
20 changes: 14 additions & 6 deletions tests/management/test_resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.contrib.auth.models import User
from swaggapi.api.builder.client import requester

from rotest.management import BaseResource
from rotest.management import BaseResource, DataPointer
from rotest.management.common.utils import LOCALHOST
from rotest.management.client.manager import (ClientResourceManager,
ResourceRequest)
Expand Down Expand Up @@ -1315,10 +1315,6 @@ def initialize(self):
"Expected resource with name %r but got %r"
% (self.COMPLEX_NAME, resource.name))

self.assertEquals(resource.name, resource.demo3.name,
"Expected sub-service with name %r but got %r"
% (resource.name, resource.demo3.name))

self.assertIsInstance(resource, request.type,
"Expected resource of type %r, but got %r"
% (request.type.__name__,
Expand All @@ -1328,6 +1324,10 @@ def initialize(self):
"Expected to have 3 sub-resources, found %r"
% resource.get_sub_resources())

self.assertEquals(resource.name, resource.demo3.name,
"Expected sub-service with name %r but got %r"
% (resource.name, resource.demo3.name))

self.assertTrue(resource.data.initialization_flag,
"Resource %r should have been initialized" %
resource.name)
Expand Down Expand Up @@ -1378,7 +1378,7 @@ class AlterDemoComplexService(BaseResource):
"""Fake complex service class, used in resource manager tests."""
DATA_CLASS = None
demo1 = DemoService()
demo2 = DemoService()
demo2 = DemoService(name=DataPointer('name'))

initialized = False

Expand Down Expand Up @@ -1406,6 +1406,14 @@ def initialize(self):
"Expected to have 2 sub-resources, found %r"
% resource.get_sub_resources())

self.assertEquals(resource.name, resource.demo2.name,
"Expected sub-service with name %r but got %r"
% (resource.name, resource.demo2.name))

self.assertNotEquals(resource.name, resource.demo1.name,
"Expected sub-service with name different than %r"
% (resource.name, resource.demo1.name))

self.assertTrue(resource.initialized,
"Resource %r should have been initialized" %
resource.name)
Expand Down

0 comments on commit 20530e2

Please sign in to comment.