From ebeb426f24cced2dd3a40d04a70683c1175002a8 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 17 Dec 2011 23:24:41 -0400 Subject: [PATCH] Add simple tag app tests --- apps/tags/tests.py | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/apps/tags/tests.py b/apps/tags/tests.py index 2247054b35..612cd1803e 100644 --- a/apps/tags/tests.py +++ b/apps/tags/tests.py @@ -1,23 +1,15 @@ -""" -This file demonstrates two different styles of tests (one doctest and one -unittest). These will both pass when you run "manage.py test". +from django.utils import unittest -Replace these with more appropriate tests for your application. -""" +from .models import Tag, TagProperties, COLOR_RED -from django.test import TestCase -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.failUnlessEqual(1 + 1, 2) - -__test__ = {"doctest": """ -Another way to test that 1 + 1 is equal to 2. - ->>> 1 + 1 == 2 -True -"""} +class TagTestCase(unittest.TestCase): + def setUp(self): + self.tag = Tag(name='test') + self.tag.save() + self.tp = TagProperties(tag=self.tag, color=COLOR_RED) + self.tp.save() + def runTest(self): + self.failUnlessEqual(self.tag.name, 'test') + self.failUnlessEqual(self.tp.get_color_code(), 'red')