Added tests for author and publisher searches
parent
b43901482a
commit
808be30a08
|
@ -12,13 +12,35 @@ def test_successful_title_search(client):
|
|||
assert res.status_code == 200
|
||||
assert b'<div class = "results">' in res.data
|
||||
|
||||
# Test that an unsuccessful title search returns to the home screen
|
||||
def test_unsuccessful_full_text_search(client):
|
||||
# Test that an unsuccessful title search renders an error message
|
||||
def test_unsuccessful_title_search(client):
|
||||
res = client.get("/?title=blahhblahblahblah&author=&publisher=®istration=&renewal=")
|
||||
assert res.status_code == 200
|
||||
assert b'No results found. Please try another search.' in res.data
|
||||
|
||||
# TODO: add author and publisher tests when necessary functionality is complete
|
||||
# Test that a successful author search yields results
|
||||
def test_successful_author_search(client):
|
||||
res = client.get("/?title=&author=Smith&publisher=®istration=&renewal=")
|
||||
assert res.status_code == 200
|
||||
assert b'<div class = "results">' in res.data
|
||||
|
||||
# Test that an unsuccessful title search renders an error message
|
||||
def test_unsuccessful_author_search(client):
|
||||
res = client.get("/?title=&author=IAMNOTANAUTHOR&publisher=®istration=&renewal=")
|
||||
assert res.status_code == 200
|
||||
assert b'No results found. Please try another search.' in res.data
|
||||
|
||||
# Test that a successful publisher search yields results
|
||||
def test_successful_publisher_search(client):
|
||||
res = client.get("/?title=&author=&publisher=Penguin®istration=&renewal=")
|
||||
assert res.status_code == 200
|
||||
assert b'<div class = "results">' in res.data
|
||||
|
||||
# Test that an unsuccessful publisher search renders an error message
|
||||
def test_unsuccessful_publisher_search(client):
|
||||
res = client.get("/?title=&author=&publisher=FAKEPUBLISHERINC®istration=&renewal=")
|
||||
assert res.status_code == 200
|
||||
assert b'No results found. Please try another search.' in res.data
|
||||
|
||||
# Test that a successful registration number search yields results
|
||||
def test_successful_registration_number_search(client):
|
||||
|
@ -26,7 +48,7 @@ def test_successful_registration_number_search(client):
|
|||
assert res.status_code == 200
|
||||
assert b'<div class = "results">' in res.data
|
||||
|
||||
# Test that an unsuccessful registration number search returns to the home screen
|
||||
# Test that an unsuccessful registration number search renders an error message
|
||||
def test_unsuccessful_registration_number_search(client):
|
||||
res = client.get("/?title=&author=&publisher=®istration=NOTANUMBER&renewal=")
|
||||
assert res.status_code == 200
|
||||
|
@ -38,7 +60,7 @@ def test_successful_renewal_number_search(client):
|
|||
assert res.status_code == 200
|
||||
assert b'<div class = "results">' in res.data
|
||||
|
||||
# Test that an unsuccessful registration number search returns to the home screen
|
||||
# Test that an unsuccessful registration number search renders an error message
|
||||
def test_unsuccessful_renewal_number_search(client):
|
||||
res = client.get("/?title=&author=&publisher=®istration=&renewal=NOTANUMBER")
|
||||
assert res.status_code == 200
|
||||
|
|
Loading…
Reference in New Issue