
import testtools

from solum.common import service
from solum import objects
from solum.objects import plan as abstract
from solum.tests import base


class TestService(base.BaseTestCase):

    def test_prepare_invokes_object_load(self):
        objects.registry.clear()
        with testtools.ExpectedException(KeyError):
            objects.registry.Plan()
        service.prepare_service([])
        self.assertTrue(issubclass(objects.registry.Plan, abstract.Plan))


import testtools

from solum.common import service
from solum import objects
from solum.objects import component as abstract
from solum.tests import base


class TestService(base.BaseTestCase):

    def test_prepare_invokes_object_load(self):
        objects.registry.clear()
        with testtools.ExpectedException(KeyError):
            objects.registry.Component()
        service.prepare_service([])
        self.assertTrue(issubclass(objects.registry.Component,
                                   abstract.Component))

Test service with Component instead of Plan db object
Test service with Component instead of Plan db object

Since plan db objects are getting removed in add-plan-in-swift,
we need to test service with another object.

Change-Id: I85537ef17f8c125d3de85ab3625ea91e9487376f

  
  import testtools
  
  from solum.common import service
  from solum import objects
- from solum.objects import plan as abstract
+ from solum.objects import component as abstract
  from solum.tests import base
  
  
  class TestService(base.BaseTestCase):
  
      def test_prepare_invokes_object_load(self):
          objects.registry.clear()
          with testtools.ExpectedException(KeyError):
-             objects.registry.Plan()
+             objects.registry.Component()
          service.prepare_service([])
-         self.assertTrue(issubclass(objects.registry.Plan, abstract.Plan))
+         self.assertTrue(issubclass(objects.registry.Component,
+                                    abstract.Component))
  
Test service with Component instead of Plan db object
## Code Before:

import testtools

from solum.common import service
from solum import objects
from solum.objects import plan as abstract
from solum.tests import base


class TestService(base.BaseTestCase):

    def test_prepare_invokes_object_load(self):
        objects.registry.clear()
        with testtools.ExpectedException(KeyError):
            objects.registry.Plan()
        service.prepare_service([])
        self.assertTrue(issubclass(objects.registry.Plan, abstract.Plan))

## Instruction:
Test service with Component instead of Plan db object
## Code After:

import testtools

from solum.common import service
from solum import objects
from solum.objects import component as abstract
from solum.tests import base


class TestService(base.BaseTestCase):

    def test_prepare_invokes_object_load(self):
        objects.registry.clear()
        with testtools.ExpectedException(KeyError):
            objects.registry.Component()
        service.prepare_service([])
        self.assertTrue(issubclass(objects.registry.Component,
                                   abstract.Component))
