示例#1
0
 def test_post_reservation_error_date_check_to(self):
     user = create_user(self.session)[1]
     auth_data = f"{user['user_name']}:{user['password']}".encode()
     credentials = base64.b64encode(auth_data).decode('utf-8')
     create_audience(self.session)
     data = get_test_reservation_data(from_date='2000-01-15')
     create_reservation(self.session, data=data)
     reservation = get_test_reservation_data()
     response = self.app.post('/reservation/', json=reservation, headers={
         'Authorization': f'Basic {credentials}'})
     self.assertEqual(405, response.status_code)
示例#2
0
 def test_post_reservation_successful(self):
     user = create_user(self.session)[1]
     auth_data = f"{user['user_name']}:{user['password']}".encode()
     credentials = base64.b64encode(auth_data).decode('utf-8')
     create_audience(self.session)
     reservation = get_test_reservation_data()
     response = self.app.post('/reservation/', json=reservation, headers={
         'Authorization': f'Basic {credentials}'})
     self.assertEqual(200, response.status_code)