Пример #1
0
def init_database():
    database.connect()
    database.create_tables([Post, User])

    User.truncate_table()
    Post.truncate_table()

    repos = load_json('repos.json')
    for repo in repos:
        user, created = build_user(repo['owner']['login'])
        Post.create(title=repo['name'],
                    slug=repo['full_name'],
                    body=repo['description'],
                    user=user)

    database.close()
Пример #2
0
 def tearDown(self):
     database.drop_tables([PlaceBook, Place, User, State, City])
     database.close()
Пример #3
0
	def tearDown(self):
		database.drop_tables([User, State, City, Place, Review, ReviewUser, ReviewPlace])
		database.close()
Пример #4
0
	def tearDown(self):
		database.drop_tables([City, State, Place, User, PlaceBook])
		database.close()
Пример #5
0
	def tearDown(self):
		database.drop_tables([State])
		database.close()
Пример #6
0
def after_request(response):
    database.close()
    return response
Пример #7
0
	def tearDown(self):
		database.drop_tables([Amenity, PlaceAmenities, Place, State, User, City])
		database.close()
Пример #8
0
from app.models.base import database
from app.models.user import User
from app.models.city import City
from app.models.state import State
from app.models.place import Place
from app.models.place_book import PlaceBook
from app.models.amenity import Amenity
from app.models.place_amenity import PlaceAmenities
from app.models.review import Review
from app.models.review_user import ReviewUser
from app.models.review_place import ReviewPlace

database.connect()
database.create_tables([User, State, City, Place, Amenity, PlaceBook, PlaceAmenities, Review, ReviewUser, ReviewPlace], safe = True)
database.close()
Пример #9
0
def after_request():
    database.close()
Пример #10
0
 def tearDown(self):
     database.drop_tables(
         [User, State, City, Place, Review, ReviewUser, ReviewPlace])
     database.close()
Пример #11
0
from app.models.base import database
from app.models.user import User
from app.models.city import City
from app.models.state import State
from app.models.place import Place
from app.models.place_book import PlaceBook
from app.models.amenity import Amenity
from app.models.place_amenity import PlaceAmenities
from app.models.review import Review
from app.models.review_place import ReviewPlace
from app.models.review_user import ReviewUser
''' Initializes each table in the database '''
database.connect()
database.create_tables([User, State, City, Place, Amenity, PlaceBook, PlaceAmenities, Review, ReviewUser, ReviewPlace], safe=True)
database.close()
Пример #12
0
def after_request():
	database.close()
Пример #13
0
 def tearDown(self):
     database.drop_tables([City, State, Place, User, PlaceBook])
     database.close()
Пример #14
0
	def tearDown(self):
		database.drop_tables([User])
		database.close()
Пример #15
0
	def tearDown(self):
		database.drop_tables([PlaceBook, Place, User, State, City])
		database.close()
Пример #16
0
 def tearDown(self):
     database.drop_tables([User])
     database.close()