def setUp(self):

        logging.basicConfig(level=logging.INFO)
        db.engine.execute("DROP SCHEMA IF EXISTS bookbrainz CASCADE")
        db.engine.execute("CREATE SCHEMA bookbrainz")
        create_all(db.engine)

        random.seed()
        load_data(db)
示例#2
0
    def setUp(self):

        logging.basicConfig(level=logging.INFO)
        db.engine.execute("DROP SCHEMA IF EXISTS bookbrainz CASCADE")
        db.engine.execute("CREATE SCHEMA bookbrainz")
        create_all(db.engine)

        random.seed()
        load_data(db)
    def setUp(self):

        logging.basicConfig(level=logging.INFO)
        db.engine.execute("DROP SCHEMA IF EXISTS bookbrainz CASCADE")
        db.engine.execute("CREATE SCHEMA bookbrainz")
        create_all(db.engine)

        random.seed()
        load_data(db)

        response = self.client.post(
            '/oauth/token',
            data={
                'client_id': '9ab9da7e-a7a3-4f86-87c6-bf8b4b8213c7',
                'username': '******',
                'password': "******",
                'grant_type': 'password'
            })

        self.assert200(response)
        oauth_access_token = response.json.get(u'access_token')

        self.request_default_headers = Headers(
            [('Authorization', 'Bearer ' + oauth_access_token),
             ('Content-Type', 'application/json')])

        self.specific_setup()

        """
         Specific names are names of the attributes/keys that
         change with different types of entities.
         Keys:
          'entity_class': some class which inherits from Entity (like Creator)
          'type_name': name as a type (like u'Creator')
          'ws_name': name in the web service urls(like 'creator')
          'entity_type_class': (like CreatorType)
          'entity_type': (like 'work_type')
          'entity_type_id': (like 'work_type_id')
        """
        self.specific_names = {}
        self.set_specific_names()
        self.check_specific_names()
示例#4
0
 def setUp(self):
     db.engine.execute("DROP SCHEMA IF EXISTS bookbrainz CASCADE")
     db.engine.execute("CREATE SCHEMA bookbrainz")
     create_all(db.engine)
     load_data(db)
示例#5
0
 def setUp(self):
     db.engine.execute("DROP SCHEMA IF EXISTS bookbrainz CASCADE")
     db.engine.execute("CREATE SCHEMA bookbrainz")
     create_all(db.engine)
     load_data(db)
示例#6
0
def create_all(hostname, port, username, password, db_name):
    connection_string =\
        'postgresql://{}:{}@{}/{}'.format(username, password, hostname,
                                          db_name)
    engine = create_engine(connection_string, echo=True)
    bbschema.create_all(engine)