def test_post_movie_with_valid_data(self): new_movie = {'title': 'Captan Marvel', 'year': 2019} status_code, data = post_api('movies', new_movie) assert status_code == 201 assert data['title'] == 'Captan Marvel' assert data['year'] == 2019 assert isinstance(data['id'], str)
def test_post_person_with_null_data(self): new_person = {'first_name': '', 'last_name': '', 'birth_year': ''} status_code, data = post_api('persons', new_person) assert status_code == 201 assert data['first_name'] == '' assert data['last_name'] == '' assert data['birth_year'] == '' assert isinstance(data['id'], str)
def test_post_person_with_valid_data(self): new_person = { 'first_name': 'Patrick', 'last_name': 'Stewart', 'birth_year': 1940 } status_code, data = post_api('persons', new_person) assert status_code == 201 assert data['first_name'] == 'Patrick' assert data['last_name'] == 'Stewart' assert data['birth_year'] == 1940 assert isinstance(data['id'], str)
def test_post_person_with_empty_data(self): new_person = {} status_code, data = post_api('persons', new_person) assert status_code == 400
def test_post_movie_with_invalid_date(self): new_movie = {'title': '', 'year': 'test'} status_code, data = post_api('movies', new_movie) assert status_code == 201 assert data['year'] == 'test' assert isinstance(data['id'], str)
def test_post_movie_with_empty_data(self): new_movie = {} status_code, data = post_api('movies', new_movie) assert status_code == 400