chaging tests to aknowledge helpdesk namespace

This commit is contained in:
Alex Barcelo 2015-12-22 11:20:52 +01:00
parent f5ecb67b22
commit a741395ce5
4 changed files with 11 additions and 6 deletions

View File

@ -539,7 +539,7 @@ class Ticket(models.Model):
return '%s %s' % (self.id, self.title) return '%s %s' % (self.id, self.title)
def get_absolute_url(self): def get_absolute_url(self):
return ('helpdesk_view', (self.id,)) return ('helpdesk:view', (self.id,))
get_absolute_url = models.permalink(get_absolute_url) get_absolute_url = models.permalink(get_absolute_url)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
@ -928,7 +928,7 @@ class KBCategory(models.Model):
verbose_name_plural = _('Knowledge base categories') verbose_name_plural = _('Knowledge base categories')
def get_absolute_url(self): def get_absolute_url(self):
return ('helpdesk_kb_category', (), {'slug': self.slug}) return ('kb_category', (), {'slug': self.slug})
get_absolute_url = models.permalink(get_absolute_url) get_absolute_url = models.permalink(get_absolute_url)
@ -996,7 +996,7 @@ class KBItem(models.Model):
verbose_name_plural = _('Knowledge base items') verbose_name_plural = _('Knowledge base items')
def get_absolute_url(self): def get_absolute_url(self):
return ('helpdesk_kb_item', (self.id,)) return ('helpdesk:kb_item', (self.id,))
get_absolute_url = models.permalink(get_absolute_url) get_absolute_url = models.permalink(get_absolute_url)

View File

@ -26,11 +26,11 @@ class TestKBDisabled(TestCase):
from django.core.urlresolvers import NoReverseMatch from django.core.urlresolvers import NoReverseMatch
self.client.login(username=get_staff_user().get_username(), password='password') self.client.login(username=get_staff_user().get_username(), password='password')
self.assertRaises(NoReverseMatch, reverse, 'helpdesk_kb_index') self.assertRaises(NoReverseMatch, reverse, 'helpdesk:kb_index')
try: try:
response = self.client.get(reverse('helpdesk:dashboard')) response = self.client.get(reverse('helpdesk:dashboard'))
except NoReverseMatch as e: except NoReverseMatch as e:
if 'helpdesk_kb_index' in e.message: if 'helpdesk:kb_index' in e.message:
self.fail("Please verify any unchecked references to helpdesk_kb_index (start with navigation.html)") self.fail("Please verify any unchecked references to helpdesk_kb_index (start with navigation.html)")
else: else:
raise raise

5
helpdesk/tests/urls.py Normal file
View File

@ -0,0 +1,5 @@
from django.conf.urls import include, url
urlpatterns = [
url(r'^helpdesk/', include('helpdesk.urls', namespace='helpdesk')),
]

View File

@ -90,7 +90,7 @@ class QuickDjangoTest(object):
}, },
INSTALLED_APPS = self.INSTALLED_APPS + self.apps, INSTALLED_APPS = self.INSTALLED_APPS + self.apps,
MIDDLEWARE_CLASSES = self.MIDDLEWARE_CLASSES, MIDDLEWARE_CLASSES = self.MIDDLEWARE_CLASSES,
ROOT_URLCONF = self.apps[0] + '.urls', ROOT_URLCONF = 'tests.urls',
STATIC_URL = '/static/' STATIC_URL = '/static/'
) )