# Path: tags/models.py
# class Tag(models.Model):
#     TAG_GROUPS = (
#         (1, "School"),
#         (2, "Liberation"),
#         (3, "Other")
#     )
#     id = models.AutoField(primary_key=True)
#     name = models.CharField(max_length=100, unique=True)
#     slug = models.SlugField(blank=False, max_length=100)
#     group = models.IntegerField(choices=TAG_GROUPS, default=1)
#     description = models.TextField(blank=True)
# 
#     def save(self, *args, **kwargs):
#         self.slug = slugify(self.name, max_length=100)
#         super(Tag, self).save(*args, **kwargs)
# 
#     def get_absolute_url(self):
#         return reverse("tag", kwargs={"tagId": self.id, "slug": self.slug})
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: core/tests.py
# class BaseTestCase(TestCase):
#     """
#     Base class for all test cases setting up Haystack and adding objects.
#     """
#     def setUp(self):
#         add_objects(self)
#         haystack.connections.reload('default')
#         super(BaseTestCase, self).setUp()
# 
#     def tearDown(self):
#         call_command('clear_index', interactive=False, verbosity=0)


from django.core.urlresolvers import reverse
from tags.models import Tag
from core.tests import BaseTestCase



class TagTest (BaseTestCase):

    def testView(self):
        url = reverse('tag', args=[self.tag.id, self.tag.slug])
        response = self.client.get(url)

# Path: tags/models.py
# class Tag(models.Model):
#     TAG_GROUPS = (
#         (1, "School"),
#         (2, "Liberation"),
#         (3, "Other")
#     )
#     id = models.AutoField(primary_key=True)
#     name = models.CharField(max_length=100, unique=True)
#     slug = models.SlugField(blank=False, max_length=100)
#     group = models.IntegerField(choices=TAG_GROUPS, default=1)
#     description = models.TextField(blank=True)
# 
#     def save(self, *args, **kwargs):
#         self.slug = slugify(self.name, max_length=100)
#         super(Tag, self).save(*args, **kwargs)
# 
#     def get_absolute_url(self):
#         return reverse("tag", kwargs={"tagId": self.id, "slug": self.slug})
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: core/tests.py
# class BaseTestCase(TestCase):
#     """
#     Base class for all test cases setting up Haystack and adding objects.
#     """
#     def setUp(self):
#         add_objects(self)
#         haystack.connections.reload('default')
#         super(BaseTestCase, self).setUp()
# 
#     def tearDown(self):
#         call_command('clear_index', interactive=False, verbosity=0)


# Path: tags/tests.py
from django.core.urlresolvers import reverse
from tags.models import Tag
from core.tests import BaseTestCase




class TagTest (BaseTestCase):

    def testView(self):
        url = reverse('tag', args=[self.tag.id, self.tag.slug])
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)