Esempio n. 1
0
class ApplicationTests(unittest.TestCase):
    def setUp(self) -> None:
        self.app = Application("sample_app")

        # client --> comp1 --> comp2 --> comp3
        self.client = Component(self.app, "client", "client",
                                ComponentType.UNMANAGED)
        self.comp1 = Component(self.app, "comp1", "comp1",
                               ComponentType.MANAGED)
        self.comp2 = Component(self.app, "comp2", "comp2",
                               ComponentType.MANAGED)
        self.comp3 = Component(self.app, "comp3", "comp3",
                               ComponentType.MANAGED)
        self.client.add_dependency(self.comp1)
        self.comp1.add_dependency(self.comp2)
        self.comp2.add_dependency(self.comp3)

        self.managed_components = [self.comp1, self.comp2, self.comp3]
        self.unmanaged_components = [self.client]

        self.app.add_components(
            [self.client, self.comp1, self.comp2, self.comp3])

    def test_list_managed_components(self):
        for managed_component in self.app.list_managed_components():
            self.assertTrue(managed_component in self.managed_components)

    def test_list_unmanaged_components(self):
        for unmanaged_component in self.app.list_unmanaged_components():
            self.assertTrue(unmanaged_component in self.unmanaged_components)
Esempio n. 2
0
 def _cc_operations_required(self, app: Application) -> bool:
     return self.knowledge.client_support and len(list(app.list_unmanaged_components())) > 0