diff --git a/hc/api/tests.py b/hc/api/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/hc/api/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/hc/api/tests/__init__.py b/hc/api/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/hc/api/tests/test_ping.py b/hc/api/tests/test_ping.py new file mode 100644 index 00000000..a3971242 --- /dev/null +++ b/hc/api/tests/test_ping.py @@ -0,0 +1,20 @@ +from django.contrib.auth.models import User +from django.test import TestCase + +from hc.api.models import Check + + +class PingTestCase(TestCase): + + def test_it_works(self): + user = User(username="jdoe") + user.save() + + check = Check(user=user) + check.save() + + r = self.client.get("/ping/%s/" % check.code) + assert r.status_code == 200 + + same_check = Check.objects.get(code=check.code) + assert same_check.status == "up"