Skip to content

Commit

Permalink
Adds tests for ip and protocal
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonGeek committed Dec 14, 2016
1 parent 771c237 commit 835a9b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hc/api/tests/test_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def test_it_reads_forwarded_ip(self):
r = self.client.get("/ping/%s/" % self.check.code,
HTTP_X_FORWARDED_FOR=ip)
ping = Ping.objects.latest("id")
self.assertEqual(r.status_code, 200)
self.assertEqual(ping.remote_addr, "1.1.1.1")
### Assert the expected response status code and ping's remote address

ip = "1.1.1.1, 2.2.2.2"
Expand All @@ -62,6 +64,8 @@ def test_it_reads_forwarded_protocol(self):
r = self.client.get("/ping/%s/" % self.check.code,
HTTP_X_FORWARDED_PROTO="https")
ping = Ping.objects.latest("id")
self.assertEqual(r.status_code, 200)
self.assertEqual(ping.scheme, 'https')
### Assert the expected response status code and ping's scheme

def test_it_never_caches(self):
Expand Down

0 comments on commit 835a9b3

Please sign in to comment.