Skip to content

Commit 0206185

Browse files
committed
Fixes #100: Improve status method tests to have full coverage.
This commit get the 100% coverage of status() method by passing wrong url to method, to be sure that method does handle wrong url return proper result.
1 parent 421ebe0 commit 0206185

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

loklak.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ def getBaseUrl(self):
6060
"""Return the string value of baseUrl."""
6161
return self.baseUrl
6262

63-
def status(self):
63+
def status(self, status_application='api/status.json'):
6464
"""Retrieve a json response about the status of the server."""
65-
status_application = 'api/status.json'
66-
url_to_give = self.baseUrl+status_application
65+
url_to_give = self.baseUrl + status_application
6766
return_to_user = requests.get(url_to_give)
6867
if return_to_user.status_code == 200:
6968
return return_to_user.json()

tests/test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ def test_status(self):
2929
msg='{} not found in index'.format(prop)
3030
)
3131

32+
result = self.loklak.status("nonexisturl")
33+
self.assertEqual(result, "{}")
34+
3235
def test_hello(self):
3336
"""Test hello instance."""
3437
result = self.loklak.hello()

0 commit comments

Comments
 (0)