Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Bug 756533 - Move actioncounters test model into own package.
Browse files Browse the repository at this point in the history
This prevents the creation of the table in non test environments.
  • Loading branch information
jezdez committed Jan 20, 2015
1 parent 32a6c8b commit 745a173
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
15 changes: 0 additions & 15 deletions kuma/actioncounters/models.py
Expand Up @@ -9,21 +9,6 @@
from django.utils.translation import ugettext_lazy as _

from .utils import get_unique
from .fields import ActionCounterField


class TestModel(models.Model):
# TODO: Find a way to move this to tests.py and create only during testing!

title = models.CharField(max_length=255, blank=False, unique=True)

likes = ActionCounterField()
views = ActionCounterField(max_total_per_unique=5)
frobs = ActionCounterField(min_total_per_unique=-5)
boogs = ActionCounterField(min_total_per_unique=-5, max_total_per_unique=5)

def __unicode__(self):
return unicode(self.pk)


class ActionCounterUniqueManager(models.Manager):
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions kuma/actioncounters/tests/models.py
@@ -0,0 +1,15 @@
from django.db import models

from ..fields import ActionCounterField


class TestModel(models.Model):
title = models.CharField(max_length=255, blank=False, unique=True)

likes = ActionCounterField()
views = ActionCounterField(max_total_per_unique=5)
frobs = ActionCounterField(min_total_per_unique=-5)
boogs = ActionCounterField(min_total_per_unique=-5, max_total_per_unique=5)

def __unicode__(self):
return unicode(self.pk)
Expand Up @@ -13,8 +13,9 @@
from nose.tools import eq_, ok_
from nose.plugins.attrib import attr

from .utils import get_unique
from .models import TestModel, ActionCounterUnique
from ..utils import get_unique
from ..models import ActionCounterUnique
from .models import TestModel


class ActionCountersTest(TestCase):
Expand Down
5 changes: 4 additions & 1 deletion settings_test.py
Expand Up @@ -3,4 +3,7 @@
CELERY_ALWAYS_EAGER = True
ES_LIVE_INDEX = False

INSTALLED_APPS += ('kuma.core.tests.taggit_extras',)
INSTALLED_APPS += (
'kuma.core.tests.taggit_extras',
'kuma.actioncounters.tests',
)

0 comments on commit 745a173

Please sign in to comment.