def setUp(self):
        """PREREQUISITES"""
        PlanAdapter.create_table()
        ServiceTypeAdapter.create_table()
        PlanServiceTypeAdapter.create_table()
        self.service = ServiceTypeAdapter.sample_model('manifest1')
        ServiceTypeAdapter.save(self.service)

        ManifestAdapter.create_table()
        self.test_model = ManifestAdapter.sample_model('manifest1')
        _, self.result = SQLStore.add_manifest(self.test_model)
Ejemplo n.º 2
0
    def add_service(service: ServiceType) -> tuple:
        if ServiceTypeAdapter.exists_in_db(service.id):
            return 'The service already exists in the catalog.', 409

        PlanAdapter.create_table()
        PlanServiceTypeAdapter.create_table()

        ServiceTypeAdapter.save(service)
        if ServiceTypeAdapter.exists_in_db(service.id):
            return 'Service added successfully', 200
        else:
            return 'Could not save the Service in the DB', 500
    def setUp(self):
        """ PREREQUISITES """
        PlanAdapter.create_table()
        ServiceTypeAdapter.create_table()
        PlanServiceTypeAdapter.create_table()
        # ManifestAdapter.create_table()
        self.service = ServiceTypeAdapter.sample_model('instance1')
        ServiceTypeAdapter.save(self.service)

        Adapter.create_table()
        self.test_model = Adapter.sample_model('instance1')
        self.id_name = Adapter.get_id(self.test_model)
        _, self.result = SQLStore.add_service_instance(self.test_model)
 def test_adapter_save_to_update(self):
     self.test_model.name = 'new-name'
     model_sql = ServiceTypeAdapter.save(self.test_model)
     exists = ServiceTypeAdapter.exists_in_db(model_sql.id_name)
     self.assertTrue(exists)