Broken test fixes; funfactory tweaks
This commit is contained in:
Родитель
5ad9e441f2
Коммит
7138da8f34
|
@ -1,5 +1,5 @@
|
|||
{% if badge.allows_nominate_for(request.user) %}
|
||||
<li><a class="edit_badge" href="{{ url('badger_multiplayer.views.nominate_for', badge.slug) }}">{{ _('Submit nomination') }}</a></li>
|
||||
<li><a class="nominate_badge" href="{{ url('badger_multiplayer.views.nominate_for', badge.slug) }}">{{ _('Submit nomination') }}</a></li>
|
||||
{% endif %}
|
||||
{% if badge.allows_edit_by(request.user) %}
|
||||
<li><a class="edit_badge" href="{{ url('badger_multiplayer.views.edit', badge.slug) }}">{{ _('Edit badge') }}</a></li>
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
from django.db.models import loading
|
||||
from django import test
|
||||
|
||||
import badger
|
||||
|
||||
|
||||
class BadgerTestCase(test.TestCase):
|
||||
"""Ensure test app and models are set up before tests"""
|
||||
apps = ('badger.tests.badger_example',
|
||||
'badger_multiplayer.tests.badger_multiplayer_example')
|
||||
|
||||
def _pre_setup(self):
|
||||
# Add the models to the db.
|
||||
self._original_installed_apps = list(settings.INSTALLED_APPS)
|
||||
for app in self.apps:
|
||||
settings.INSTALLED_APPS.append(app)
|
||||
loading.cache.loaded = False
|
||||
call_command('syncdb', interactive=False, verbosity=0)
|
||||
call_command('update_badges', verbosity=0)
|
||||
badger.autodiscover()
|
||||
# Call the original method that does the fixtures etc.
|
||||
super(test.TestCase, self)._pre_setup()
|
||||
|
||||
def _post_teardown(self):
|
||||
# Call the original method.
|
||||
super(test.TestCase, self)._post_teardown()
|
||||
# Restore the settings.
|
||||
settings.INSTALLED_APPS = self._original_installed_apps
|
||||
loading.cache.loaded = False
|
|
@ -15,16 +15,16 @@ from django.template.defaultfilters import slugify
|
|||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from . import BadgerTestCase
|
||||
|
||||
import badger
|
||||
import badger_multiplayer
|
||||
|
||||
from badger.models import (Award, Progress,
|
||||
from badger.tests import BadgerTestCase
|
||||
|
||||
from badger.models import (Progress,
|
||||
BadgeAwardNotAllowedException,
|
||||
BadgeAlreadyAwardedException)
|
||||
|
||||
from badger_multiplayer.models import (Badge, Nomination,
|
||||
from badger_multiplayer.models import (Badge, Award, Nomination,
|
||||
NominationApproveNotAllowedException,
|
||||
NominationAcceptNotAllowedException)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.conf import settings
|
|||
from django.http import HttpRequest
|
||||
from django.test.client import Client
|
||||
|
||||
from commons import LocalizingClient
|
||||
from django.test.client import Client
|
||||
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
|
@ -17,11 +17,11 @@ from django.template.defaultfilters import slugify
|
|||
from django.contrib.auth.models import User
|
||||
|
||||
try:
|
||||
from commons.urlresolvers import reverse
|
||||
from funfactory.urlresolvers import reverse
|
||||
except ImportError, e:
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from . import BadgerTestCase
|
||||
from badger.tests import BadgerTestCase
|
||||
|
||||
from badger.models import (Award, Progress,
|
||||
BadgeAwardNotAllowedException)
|
||||
|
@ -35,7 +35,7 @@ class BadgerViewsTest(BadgerTestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.testuser = self._get_user()
|
||||
self.client = LocalizingClient()
|
||||
self.client = Client()
|
||||
|
||||
def tearDown(self):
|
||||
Nomination.objects.all().delete()
|
||||
|
|
Загрузка…
Ссылка в новой задаче