# coding: utf-8
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User


class GraphTest(TestCase):

    def setUp(self):
        self.c = Client()
        self.user = User.objects.create(
            username='admin', password='<PASSWORD>',
            is_active=True, is_staff=True, is_superuser=True)
        self.user.set_password('<PASSWORD>')
        self.user.save()
        self.login = self.c.login(username='admin', password='<PASSWORD>')
        self.resp = self.c.get('/admin/graph-of-pets/')

    def test_get(self):
        """
        GET / must return status code 200.
        """
        self.assertEqual(200, self.resp.status_code)

    def test_template(self):
        self.assertTemplateUsed(self.resp, 'core/graph.html')

    def test_context(self):
        self.assertEquals(
            self.resp.context['all_users'], self.resp.context['all_users'])
        self.assertEquals(
            self.resp.context['cat_users'], self.resp.context['cat_users'])
        self.assertEquals(
            self.resp.context['dog_users'], self.resp.context['dog_users'])
        self.assertEquals(
            self.resp.context['other_users'], self.resp.context['other_users'])

# coding: utf-8
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User


class GraphTest(TestCase):

    def setUp(self):
        self.c = Client()
        self.user = User.objects.create(
            username='admin', password='<PASSWORD>',
            is_active=True, is_staff=True, is_superuser=True)
        self.user.set_password('<PASSWORD>')
        self.user.save()
        self.login = self.c.login(username='admin', password='<PASSWORD>')
        self.resp = self.c.get('/admin/graph-of-pets/')

    def test_get(self):
        """
        GET / must return status code 200.
        """
        self.assertEqual(200, self.resp.status_code)

    def test_template(self):
        self.assertTemplateUsed(self.resp, 'core/graph.html')

    def test_context(self):
        self.assertEquals(
            self.resp.context['all_users'], self.resp.context['all_users'])
        self.assertEquals(
            self.resp.context['cat_users'], self.resp.context['cat_users'])
        self.assertEquals(
            self.resp.context['dog_users'], self.resp.context['dog_users'])
        self.assertEquals(
            self.resp.context['other_users'], self.resp.context['other_users'])

# coding: utf-8 GET / must return status code 200.