SHOW:
|
|
- or go back to the newest paste.
1 | @pytest.mark.django_db | |
2 | - | @pytest.mark.parametrize('title', ['', |
2 | + | @pytest.mark.parametrize('title, error_message', ( |
3 | - | 'Batman'], |
3 | + | ('', ['You must provide movie title.', 'Movie with this title already exists in database.']), |
4 | - | 'error_message', ['You must provide movie title.', |
4 | + | ('Batman', ['You must provide movie title.', 'Movie with this title already exists in database.']) |
5 | - | 'Movie with this title already exists in database.']) |
5 | + | ) |
6 | def test_movie_validate_title_missing(title, error_message): | |
7 | serializer = MovieBaseSerializer() | |
8 | with pytest.raises(ValidationError) as exc: | |
9 | serializer.validate_title(title) | |
10 | ||
11 | assert str(ValidationError(error_message)) == str(exc.value) |