Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Haizzz committed Oct 28, 2018
1 parent eaca965 commit 0316c12
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion main/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
from django.test import TestCase
from django.test import TestCase, SimpleTestCase, Client
from .models import Sponsor

# Create your tests here.


class TestFrontend(SimpleTestCase):

def test_main(self):
# smoke test front end
client = Client()
re = client.get("/")
self.assertEqual(re.status_code, 200)
# giberrish
re = client.get("/akldsjfkajsdfk")
self.assertEqual(re.status_code, 200)


class TestSponsorViewSet(TestCase):
fixtures = ["main/fixtures/sponsors.json"]

def setUp(self):
self.c = Client()

def test_view(self):
re = self.c.get("/api/sponsors/")
response = re.json()
self.assertEqual(re.status_code, 200)
self.assertEqual(response["count"],
Sponsor.objects.all().count())

0 comments on commit 0316c12

Please sign in to comment.