コード例 #1
0
    def setUp(self):
        self.app = app
        self.app.response_class = JsonTestResponse
        self.client = app.test_client()
        logging.disable(logging.CRITICAL)
        db.create_tables([User, State, City, Place, PlaceBook], safe=True)

        self.client.post('/users',
                         data={
                             'first_name': "test",
                             'last_name': "test",
                             'email': "test",
                             'password': "******"
                         })

        self.client.post('/states', data={'name': "test"})

        self.client.post('/states/1/cities', data={'name': "test", 'state': 1})

        self.client.post('/places',
                         data={
                             'owner': 1,
                             'city': 1,
                             'name': "test",
                             'description': "test",
                             'latitude': 0,
                             'longitude': 0
                         })
コード例 #2
0
    def setUp(self):
        # disabling logs
        logging.disable(logging.CRITICAL)
        self.app = app.test_client()
        # connecting to the database
        db.connect()
        # creating tables
        db.create_tables([User], safe=True)
        db.create_tables([State], safe=True)
        db.create_tables([City], safe=True)
        db.create_tables([Place], safe=True)
        db.create_tables([PlaceBook], safe=True)

        # Creating a setUp
        new_state = State(name='California')
        new_state.save()
        new_city = City(name='San Francisco', state=1)
        new_city.save()
        # Creating a new users
        user1 = User(first_name='Jon',
                     last_name='Snow',
                     email='jon@snow',
                     password='******')
        user1.save()
        new_place = Place(owner=1,
                          city=1,
                          name="Steven",
                          description="house",
                          number_rooms=3,
                          number_bathrooms=2,
                          max_guest=3,
                          price_by_night=100,
                          latitude=37.774929,
                          longitude=-122.419416)
        new_place.save()
コード例 #3
0
    def setUp(self):
        self.app = app
        self.app.response_class = JsonTestResponse
        self.client = app.test_client()
        logging.disable(logging.CRITICAL)
        db.create_tables(
            [User, Place, Review, ReviewPlace, ReviewUser, City, State],
            safe=True)

        for i in range(1, 3):
            self.client.post('/users',
                             data={
                                 'first_name': "user_" + str(i),
                                 'last_name': "user_" + str(i),
                                 'email': "user_" + str(i),
                                 'password': "******" + str(i)
                             })

        self.client.post('/states', data={'name': "state_1"})
        self.client.post('/states/1/cities',
                         data={
                             'name': "city_1",
                             'state': 1
                         })
        self.client.post('/places',
                         data={
                             'owner': 1,
                             'city': 1,
                             'name': "place_1",
                             'description': "place_1",
                             'latitude': 0,
                             'longitude': 0
                         })
コード例 #4
0
ファイル: user.py プロジェクト: dexterzt/airbnb_clone
 def setUp(self):
     self.app = app.test_client()
     logging.disable(logging.CRITICAL)
     # connecting to database
     db.connect()
     # creating a database
     db.create_tables([User], safe=True)
コード例 #5
0
ファイル: user.py プロジェクト: WaBlueKey/airbnb_clone
 def setUp(self):
     #creating a test client
     self.app = app.test_client()
     #disable logging
     logging.disable(logging.CRITICAL)
     #create User table
     db.create_tables([User], safe=True)
コード例 #6
0
    def setUp(self):
        self.app = app
        self.app.response_class = JsonTestResponse
        self.client = self.app.test_client()
        logging.disable(logging.CRITICAL)
        db.create_tables([State, City], safe=True)

        self.client.post('/states', data={'name': "test"})
コード例 #7
0
 def setUp(self):
     # disabling logs
     # logging.disable(logging.CRITICAL)
     self.app = app.test_client()
     # connecting to the database
     db.connect()
     db.create_tables([State], safe=True)
     db.create_tables([City], safe=True)
コード例 #8
0
ファイル: user.py プロジェクト: nappybrainiac/airbnb_clone
 def setUp(self):
     self.app = app
     # create a test client
     self.app = app.test_client()
     self.app.response_class = JsonTestResponse
     # disable logging except for critical cases
     logging.disable(logging.CRITICAL)
     # create User table
     db.create_tables([User], safe=True)
コード例 #9
0
 def setUp(self):
     self.app = app.test_client()
     logging.disable(logging.CRITICAL)
     # connectting to database
     db.connect()
     db.create_tables([User], safe=True)
     db.create_tables([State], safe=True)
     db.create_tables([City], safe=True)
     db.create_tables([Place], safe=True)
     db.create_tables([PlaceBook], safe=True)
コード例 #10
0
    def setUp(self):
        self.app = app
        self.app.response_class = JsonTestResponse
        self.client = self.app.test_client()
        logging.disable(logging.CRITICAL)
        db.create_tables([User, City, Place, State], safe=True)

        self.client.post('/states', data={'name': "test"})
        self.client.post('/states/1/cities', data={
            'name': "test",
        })
        self.client.post('/users', data={
            'first_name': "test",
            'last_name': "test",
            'email': "test",
            'password': "******"
        })
コード例 #11
0
 def setUp(self):
     # logging.disable(logging.CRITICAL)
     self.app = app.test_client()
     db.connect()
     db.create_tables([User], safe=True)
     db.create_tables([State], safe=True)
     db.create_tables([City], safe=True)
     db.create_tables([Place], safe=True)
     db.create_tables([Amenity], safe=True)
     db.create_tables([PlaceAmenities], safe=True)
コード例 #12
0
 def setUp(self):
     self.app = app
     self.app.response_class = JsonTestResponse
     logging.disable(logging.CRITICAL)
     self.client = self.app.test_client()
     db.create_tables([Amenity], safe=True)