Successful search tests now support new UI

pull/8/head
Dylan DiGeronimo 2020-04-19 21:22:14 -04:00
parent 43f49e3816
commit da9775e33f
1 changed files with 18 additions and 24 deletions

View File

@ -5,19 +5,17 @@ from bs4 import BeautifulSoup
# TODO: Update these tests to comply with the updated UI
# Test that the application successfully serves the main page
# def test_search_page(client):
# res = client.get("/")
# assert res.status_code == 200
# page = BeautifulSoup(res.data, 'html.parser')
# assert page.title.string == "Find Copyright Entries - CCE Search"
def test_search_page(client):
res = client.get("/")
assert res.status_code == 200
page = BeautifulSoup(res.data, 'html.parser')
assert page.title.string == "Copyright Renewals"
# Test that a successful full text search yields results
# def test_successful_full_text_search(client):
# res = client.get("/?type=ft&term=I+Ching")
# assert res.status_code == 200
# assert b'<h2>Results</h2>' in res.data
# TODO: Convert to more intelligent solution using beautiful soup?
# page = BeautifulSoup(res.data, 'html.parser')
# Test that a successful title search yields results
def test_successful_title_search(client):
res = client.get("/?title=Jungle&author=&publisher=&registration=&renewal=")
assert res.status_code == 200
assert b'<div class = "results">' in res.data
# Test that an unsuccessful full text search returns to the home screen
# def test_unsuccessful_full_text_search(client):
@ -29,12 +27,10 @@ from bs4 import BeautifulSoup
# assert result_page.string == home_page.string
# Test that a successful registration number search yields results
# def test_successful_registration_number_search(client):
# res = client.get("/?type=reg&term=A45173")
# assert res.status_code == 200
# assert b'<h2>Results</h2>' in res.data
# TODO: Convert to more intelligent solution using beautiful soup?
# page = BeautifulSoup(res.data, 'html.parser')
def test_successful_registration_number_search(client):
res = client.get("/?title=&author=&publisher=&registration=A45173&renewal=")
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
# def test_unsuccessful_registration_number_search(client):
@ -46,12 +42,10 @@ from bs4 import BeautifulSoup
# assert result_page.string == home_page.string
# Test that a successful renewal number search yields results
# def test_successful_renewal_number_search(client):
# res = client.get("/?type=ren&term=R673507")
# assert res.status_code == 200
# assert b'<h2>Results</h2>' in res.data
# TODO: Convert to more intelligent solution using beautiful soup?
# page = BeautifulSoup(res.data, 'html.parser')
def test_successful_renewal_number_search(client):
res = client.get("/?title=&author=&publisher=&registration=&renewal=R673507")
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
# def test_unsuccessful_renewal_number_search(client):