2014-08-16 09:25:18 +02:00
|
|
|
|
from imp import reload
|
2013-11-29 16:47:31 +01:00
|
|
|
|
|
|
|
|
|
from django.test.client import Client
|
|
|
|
|
from django.test.utils import override_settings
|
2014-08-16 09:25:18 +02:00
|
|
|
|
from django.core.urlresolvers import clear_url_caches
|
2013-11-29 16:47:31 +01:00
|
|
|
|
|
|
|
|
|
from openslides.utils.test import TestCase
|
|
|
|
|
|
|
|
|
|
|
2015-01-22 18:29:12 +01:00
|
|
|
|
@override_settings(INSTALLED_PLUGINS=('tests.old.plugin_api.test_plugin_one',))
|
2013-11-29 16:47:31 +01:00
|
|
|
|
class TestPluginOne(TestCase):
|
|
|
|
|
def setUp(self):
|
|
|
|
|
self.admin_client = Client()
|
|
|
|
|
self.admin_client.login(username='admin', password='admin')
|
|
|
|
|
|
|
|
|
|
def test_version_page(self):
|
|
|
|
|
response = self.admin_client.get('/version/')
|
|
|
|
|
self.assertContains(response, 'Test Plugin ta3Ohmaiquee2phaf9ei')
|
|
|
|
|
self.assertContains(response, '(Short description of test plugin Sah9aiQuae5hoocai7ai)')
|
|
|
|
|
self.assertContains(response, '– Version test_version_string_MoHonepahfofiree6Iej')
|
|
|
|
|
|
|
|
|
|
def test_url_patterns(self):
|
2014-08-16 09:25:18 +02:00
|
|
|
|
from openslides import urls
|
|
|
|
|
reload(urls)
|
|
|
|
|
clear_url_caches()
|
2013-11-29 16:47:31 +01:00
|
|
|
|
response = self.admin_client.get('/test_plugin_one_url_Eexea4nie1fexaax3oX7/')
|
|
|
|
|
self.assertRedirects(response, '/version/')
|
|
|
|
|
|
|
|
|
|
|
2015-01-22 18:29:12 +01:00
|
|
|
|
@override_settings(INSTALLED_PLUGINS=('tests.old.plugin_api.test_plugin_two',))
|
2013-11-29 16:47:31 +01:00
|
|
|
|
class TestPluginTwo(TestCase):
|
|
|
|
|
def test_version_page(self):
|
|
|
|
|
admin_client = Client()
|
|
|
|
|
admin_client.login(username='admin', password='admin')
|
|
|
|
|
response = admin_client.get('/version/')
|
2015-01-22 18:29:12 +01:00
|
|
|
|
self.assertContains(response, 'tests.old.plugin_api.test_plugin_two')
|
2013-11-29 16:47:31 +01:00
|
|
|
|
self.assertContains(response, '– Version unknown')
|