def test_already_initialized_database_failure(self):
     """raise RepositoryAlreadyExists"""
     dbstring = self.dbstring
     repository = DatabaseRepository(dbstring)
     repository.initialize()
     self.assertRaises(RepositoryAlreadyExists, 
         getattr(repository, 'initialize'))
Example #2
0
def init_db(target):
    try:
        repo = DatabaseRepository(target)
        repo.initialize()
    except exc.ArgumentError:
        print("Error: The provided database URL is not valid (%s)" % target)
        usage()
    except RepositoryAlreadyExists:
        print("Error: Repository already exists in the specified datbase")
        usage()
 def test_deploy_create(self):
     """Create a table based on a JSON schema"""
     dbstring = self.dbstring
     repository = DatabaseRepository(dbstring)
     repository.initialize()
     change = {
         "change":"create",
         "schema":{
             "id":"test",
             "type":"object",
             "properties":{
                 "text_column":{"type":"string"}
             }
         }
     }
     repository.deploy(change)
     self.assertTableExists(dbstring, "test")
 def test_initialize_database(self):
     """The table _evolve should be created"""
     dbstring = self.dbstring
     repository = DatabaseRepository(dbstring)
     repository.initialize()
     self.assertTableExists(dbstring, '_evolve')