Another quick test

This commit is contained in:
Pēteris Caune 2015-06-25 22:39:39 +03:00
parent 53a20ffba2
commit 2131c6512b
3 changed files with 20 additions and 3 deletions

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

0
hc/api/tests/__init__.py Normal file
View File

20
hc/api/tests/test_ping.py Normal file
View File

@ -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"