Files
mayan-edms/mayan/apps/common/tests/test_api.py
Roberto Rosario 655c1fd09f Remove use of self.client
Replace self.client.<method> with the shorthand self.<method>

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2019-04-13 03:58:49 -04:00

34 lines
1.1 KiB
Python

from __future__ import unicode_literals
from django.urls import reverse
from django.test import override_settings
from mayan.apps.rest_api.tests import BaseAPITestCase
from ..classes import Template
TEST_TEMPLATE_RESULT = '<div'
class CommonAPITestCase(BaseAPITestCase):
def test_content_type_list_view(self):
response = self.get(viewname='rest_api:content-type-list')
self.assertEqual(response.status_code, 200)
@override_settings(LANGUAGE_CODE='de')
def test_template_detail_view(self):
self.login_user()
template_main_menu = Template.get(name='main_menu')
response = self.get(path=template_main_menu.get_absolute_url())
self.assertContains(
response=response, text=TEST_TEMPLATE_RESULT, status_code=200
)
def test_template_detail_anonymous_view(self):
template_main_menu = Template.get(name='main_menu')
response = self.get(path=template_main_menu.get_absolute_url())
self.assertNotContains(
response=response, text=TEST_TEMPLATE_RESULT, status_code=403
)