-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Remove classes from tests (website)
- Loading branch information
1 parent
1a50168
commit c973125
Showing
1 changed file
with
33 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |