mirror of https://github.com/snachodog/mybuddy.git
Add reports tests.
This commit is contained in:
parent
789054cfb6
commit
72a75feea9
|
@ -0,0 +1,49 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test import Client as HttpClient
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management import call_command
|
||||
|
||||
from faker import Factory
|
||||
|
||||
from core import models
|
||||
|
||||
|
||||
class ViewsTestCase(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ViewsTestCase, cls).setUpClass()
|
||||
fake = Factory.create()
|
||||
call_command('migrate', verbosity=0)
|
||||
call_command('fake', verbosity=0)
|
||||
|
||||
cls.c = HttpClient()
|
||||
|
||||
fake_user = fake.simple_profile()
|
||||
cls.credentials = {
|
||||
'username': fake_user['username'],
|
||||
'password': fake.password()
|
||||
}
|
||||
cls.user = User.objects.create_user(
|
||||
is_superuser=True, **cls.credentials)
|
||||
|
||||
cls.c.login(**cls.credentials)
|
||||
|
||||
def test_graph_child_views(self):
|
||||
child = models.Child.objects.first()
|
||||
base_url = '/children/{}/reports'.format(child.slug)
|
||||
|
||||
page = self.c.get('{}/changes/lifetimes/'.format(base_url))
|
||||
self.assertEqual(page.status_code, 200)
|
||||
page = self.c.get('{}/changes/types/'.format(base_url))
|
||||
self.assertEqual(page.status_code, 200)
|
||||
|
||||
page = self.c.get('{}/sleep/pattern/'.format(base_url))
|
||||
self.assertEqual(page.status_code, 200)
|
||||
page = self.c.get('{}/sleep/totals/'.format(base_url))
|
||||
self.assertEqual(page.status_code, 200)
|
||||
|
||||
page = self.c.get('{}/timeline/'.format(base_url))
|
||||
self.assertEqual(page.status_code, 200)
|
Loading…
Reference in New Issue