Skip to content

Commit

Permalink
tests: Remove classes from tests (website)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 19, 2024
1 parent 1a50168 commit c973125
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions tests/test_website.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
class TestWebsite:
def test_render_jobs(self, txrequest, site_no_egg):
content = site_no_egg.children[b"jobs"].render(txrequest)
expect_headers = {
b"Content-Type": [b"text/html; charset=utf-8"],
b"Content-Length": [b"643"],
}
if site_no_egg.local_items:
expect_headers[b"Content-Length"] = [b"601"]
def test_render_jobs(txrequest, site_no_egg):
content = site_no_egg.children[b"jobs"].render(txrequest)
expect_headers = {
b"Content-Type": [b"text/html; charset=utf-8"],
b"Content-Length": [b"643"],
}
if site_no_egg.local_items:
expect_headers[b"Content-Length"] = [b"601"]

headers = dict(txrequest.responseHeaders.getAllRawHeaders())
headers = dict(txrequest.responseHeaders.getAllRawHeaders())

assert headers == expect_headers
assert content.decode().startswith(
'<html><head><title>Scrapyd</title><style type="text/css">'
"#jobs>thead td {text-align: center; font-weight"
)
if site_no_egg.local_items:
assert b"display: none" not in content
else:
assert b"display: none" in content
assert headers == expect_headers
assert content.decode().startswith(
'<html><head><title>Scrapyd</title><style type="text/css">#jobs>thead td {text-align: center; font-weight'
)
if site_no_egg.local_items:
assert b"display: none" not in content
else:
assert b"display: none" in content

def test_render_home(self, txrequest, site_no_egg):
content = site_no_egg.children[b""].render_GET(txrequest)
expect_headers = {
b"Content-Type": [b"text/html; charset=utf-8"],
b"Content-Length": [b"714"],
}
if site_no_egg.local_items:
expect_headers[b"Content-Length"] = [b"751"]

headers = dict(txrequest.responseHeaders.getAllRawHeaders())
def test_render_home(txrequest, site_no_egg):
content = site_no_egg.children[b""].render_GET(txrequest)
expect_headers = {
b"Content-Type": [b"text/html; charset=utf-8"],
b"Content-Length": [b"714"],
}
if site_no_egg.local_items:
expect_headers[b"Content-Length"] = [b"751"]

assert headers == expect_headers
assert b"Available projects" in content
if site_no_egg.local_items:
assert b"Items" in content
else:
assert b"Items" not in content
headers = dict(txrequest.responseHeaders.getAllRawHeaders())

assert headers == expect_headers
assert b"Available projects" in content
if site_no_egg.local_items:
assert b"Items" in content
else:
assert b"Items" not in content

0 comments on commit c973125

Please sign in to comment.