예제 #1
0
 def test_get_school_invalid_id(self):
     bad_id = 'notanumber'
     response = self.get_school(school_id=bad_id)
     assert response.status_code == HTTPStatus.BAD_REQUEST
     check_error_response(response, 'school id must be a number')
예제 #2
0
 def test_get_school_not_found(self):
     bad_id = 1000000000
     response = self.get_school(school_id=bad_id)
     assert response.status_code == HTTPStatus.NOT_FOUND
     check_error_response(response, f'School with id {bad_id} not found')
예제 #3
0
 def test_update_school_invalid_id(self):
     bad_id = 'notanumber'
     response = self.update_school(school_id=bad_id, name="invalid id name")
     assert response.status_code == HTTPStatus.BAD_REQUEST
     check_error_response(response, 'school id must be a number')
예제 #4
0
 def test_add_school_bad_name_type(self):
     new_name = 42
     response = self.add_school(name=new_name)
     assert response.status_code == HTTPStatus.BAD_REQUEST
     check_error_response(response, 'Field "name" must be a string')
예제 #5
0
 def test_update_school_not_found(self):
     bad_id = 1000000000
     response = self.update_school(school_id=bad_id, name="bad id name")
     assert response.status_code == HTTPStatus.NOT_FOUND
     check_error_response(response, f'School with id {bad_id} not found')