Skip to content
This repository has been archived by the owner on Jan 30, 2022. It is now read-only.

Commit

Permalink
increased coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
P1-Ro committed Feb 17, 2018
1 parent 3af3dec commit 0daed53
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def setUp(self):
def make_request(self, data):
return self.app.post("/download/", data=json.dumps(data), headers=self.headers)

def make_wrong_request(self, data):
return self.app.post("/download/", data=json.dumps(data), headers={
"Content-Type": "application/json"
})

def test_invalid_url(self):
tmp = self.make_request(dict(
url="https://mrose"
Expand All @@ -27,11 +32,14 @@ def test_landing_page(self):
assert tmp.status_code == 200

def test_general_download(self):
old = app.conf["local_network_without_login"]
app.conf["local_network_without_login"] = False
tmp = self.make_request(dict(
url="http://theglow666.6f.sk/image_test/",
name="test",
category="test"
))
app.conf["local_network_without_login"] = old
assert tmp.status_code == 200

def test_general_download_without_name(self):
Expand All @@ -42,21 +50,17 @@ def test_general_download_without_name(self):
assert tmp.status_code == 200

def test_download_without_auth_local(self):
tmp = self.app.post("/download/", data=json.dumps(dict(
tmp = self.make_wrong_request(dict(
url="https://mrose.org/cc/png-test.png"
)), headers={
"Content-Type": "application/json"
})
))
assert tmp.status_code == 200

def test_download_without_auth_remote(self):
old = app.conf["local_network_without_login"]
app.conf["local_network_without_login"] = False
tmp = self.app.post("/download/", data=json.dumps(dict(
tmp = self.make_wrong_request(dict(
url="https://mrose.org/cc/png-test.png"
)), headers={
"Content-Type": "application/json"
})
))
app.conf["local_network_without_login"] = old
assert tmp.status_code == 401

Expand Down

0 comments on commit 0daed53

Please sign in to comment.