From b2dc319e6c5e89d6362237eeef22fa605748343b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Fri, 10 Jul 2015 12:54:18 +0300 Subject: [PATCH] "Add Check" was broken, fixing. --- hc/front/tests/test_add_check.py | 19 +++++++++++++++++++ hc/front/views.py | 2 +- templates/base.html | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 hc/front/tests/test_add_check.py diff --git a/hc/front/tests/test_add_check.py b/hc/front/tests/test_add_check.py new file mode 100644 index 00000000..b0222a0e --- /dev/null +++ b/hc/front/tests/test_add_check.py @@ -0,0 +1,19 @@ +from django.contrib.auth.models import User +from django.test import TestCase + +from hc.api.models import Check + + +class AddCheckTestCase(TestCase): + + def setUp(self): + self.alice = User(username="alice") + self.alice.set_password("password") + self.alice.save() + + def test_it_works(self): + url = "/checks/add/" + self.client.login(username="alice", password="password") + r = self.client.post(url) + assert r.status_code == 302 + assert Check.objects.count() == 1 diff --git a/hc/front/views.py b/hc/front/views.py index 48c5a8ae..97334f24 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -73,7 +73,7 @@ def add_check(request): check = Check(user=request.user) check.save() - return redirect("hc-checks") + return redirect("hc-index") @login_required diff --git a/templates/base.html b/templates/base.html index e1edf949..e7fd7ba7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,7 +3,7 @@ {% block title %}healthchecks.io - Get Notified When Your Cron Jobs Fail{% endblock %} - + {% load staticfiles %}