Ejemplo n.º 1
0
 def test_remove_api_invalid(self):
     """
     Validate API removal fails when it does not find the
     api name in the listing
     """
     core = MimicCore(Clock(), [])
     with self.assertRaises(ServiceDoesNotExist):
         core.remove_external_api('some-id')
Ejemplo n.º 2
0
 def test_remove_api_invalid(self):
     """
     Validate API removal fails when it does not find the
     api name in the listing
     """
     core = MimicCore(Clock(), [])
     with self.assertRaises(ServiceDoesNotExist):
         core.remove_external_api(
             'some-id'
         )
Ejemplo n.º 3
0
 def test_remove_api_with_endpoints(self):
     """
     Validate an API cannot be removed if it still has
     endpoints assigned to it
     """
     eeapi = make_example_external_api(self,
                                       name=self.eeapi_name,
                                       set_enabled=True)
     self.assertIsNotNone(eeapi)
     core = MimicCore(Clock(), [eeapi])
     with self.assertRaises(ServiceHasTemplates):
         core.remove_external_api(eeapi.uuid_key)
Ejemplo n.º 4
0
    def test_remove_api(self):
        """
        Removing an API.
        """
        eeapi = make_example_external_api(self,
                                          name=self.eeapi_name,
                                          set_enabled=True)
        self.assertIsNotNone(eeapi)

        template_ids = [ept.id_key for ept in eeapi.list_templates()]
        for template_id in template_ids:
            eeapi.remove_template(template_id)

        core = MimicCore(Clock(), [eeapi])
        core.remove_external_api(eeapi.uuid_key)
Ejemplo n.º 5
0
 def test_remove_api_with_endpoints(self):
     """
     Validate an API cannot be removed if it still has
     endpoints assigned to it
     """
     eeapi = make_example_external_api(
         self,
         name=self.eeapi_name,
         set_enabled=True
     )
     self.assertIsNotNone(eeapi)
     core = MimicCore(Clock(), [eeapi])
     with self.assertRaises(ServiceHasTemplates):
         core.remove_external_api(
             eeapi.uuid_key
         )
Ejemplo n.º 6
0
    def test_remove_api(self):
        """
        Removing an API.
        """
        eeapi = make_example_external_api(
            self,
            name=self.eeapi_name,
            set_enabled=True
        )
        self.assertIsNotNone(eeapi)

        template_ids = [ept.id_key for ept in eeapi.list_templates()]
        for template_id in template_ids:
            eeapi.remove_template(template_id)

        core = MimicCore(Clock(), [eeapi])
        core.remove_external_api(
            eeapi.uuid_key
        )