# Path: nosedjangotests/polls/models.py
# class Poll(models.Model):
#     question = models.CharField(max_length=200)
#     pub_date = models.DateTimeField('date published')
# 
#     @atomic
#     def reset(self):
#         self.question = ""
#         self.save()
# 
# class Choice(models.Model):
#     content_type = models.ForeignKey('contenttypes.ContentType')
#     object_id = models.PositiveIntegerField()
#     poll = GenericForeignKey('content_type', 'object_id')
# 
#     choice = models.CharField(max_length=200)
#     votes = models.IntegerField(default=0)
# 
#     @atomic
#     def reset(self):
#         self.votes = 0
#         self.save()


import datetime
from unittest import TestCase as UnitTestCase
from nose.plugins.skip import SkipTest
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from nosedjangotests.polls.models import Poll, Choice





def _test_using_content_types(self):
    p1, _ = Poll.objects.get_or_create(
        question='Who you?', pub_date=datetime.datetime.now())

    choice1 = Choice(poll=p1, choice='me')
    choice1.save()


def _test_get_contenttypes(self):
    models = [Poll, Choice]

    for model in models:
        content_type = ContentType.objects.get_for_model(model)

        # Make sure this isn't just using the cache
        ct_db = ContentType.objects.get(pk=content_type.pk)
        for attr in ['name', 'app_label', 'model']:
            self.assertEqual(
                getattr(ct_db, attr), getattr(content_type, attr))


def _test_permissions(self):
    perm_types = ['add', 'change', 'delete']

# Path: nosedjangotests/polls/models.py
# class Poll(models.Model):
#     question = models.CharField(max_length=200)
#     pub_date = models.DateTimeField('date published')
# 
#     @atomic
#     def reset(self):
#         self.question = ""
#         self.save()
# 
# class Choice(models.Model):
#     content_type = models.ForeignKey('contenttypes.ContentType')
#     object_id = models.PositiveIntegerField()
#     poll = GenericForeignKey('content_type', 'object_id')
# 
#     choice = models.CharField(max_length=200)
#     votes = models.IntegerField(default=0)
# 
#     @atomic
#     def reset(self):
#         self.votes = 0
#         self.save()


# Path: nosedjangotests/polls/tests/test1.py
import datetime
from unittest import TestCase as UnitTestCase
from nose.plugins.skip import SkipTest
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from nosedjangotests.polls.models import Poll, Choice






def _test_using_content_types(self):
    p1, _ = Poll.objects.get_or_create(
        question='Who you?', pub_date=datetime.datetime.now())

    choice1 = Choice(poll=p1, choice='me')
    choice1.save()


def _test_get_contenttypes(self):
    models = [Poll, Choice]

    for model in models:
        content_type = ContentType.objects.get_for_model(model)

        # Make sure this isn't just using the cache
        ct_db = ContentType.objects.get(pk=content_type.pk)
        for attr in ['name', 'app_label', 'model']:
            self.assertEqual(
                getattr(ct_db, attr), getattr(content_type, attr))


def _test_permissions(self):
    perm_types = ['add', 'change', 'delete']

    models = [(Poll, 'poll'), (Choice, 'choice')]