From 2131c6512bf2681d907745e57f2e3ae5852bffab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Thu, 25 Jun 2015 22:39:39 +0300 Subject: [PATCH] Another quick test --- hc/api/tests.py | 3 --- hc/api/tests/__init__.py | 0 hc/api/tests/test_ping.py | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) delete mode 100644 hc/api/tests.py create mode 100644 hc/api/tests/__init__.py create mode 100644 hc/api/tests/test_ping.py 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"