def setUpClass(cls): cls.request_factory = RequestFactory() cls.user = create_user('admin', '*****@*****.**', 'admin', is_staff=True, is_superuser=True) cls.user_staff = create_user('staff', '*****@*****.**', 'staff', is_staff=True) cls.user_normal = create_user('normal', '*****@*****.**', 'normal') cls.site_1 = Site.objects.get(pk=1) cls.site_2 = Site.objects.create(domain='http://example2.com', name='example 2')
def setUpClass(cls): cls.request_factory = RequestFactory() cls.user = create_user("admin", "*****@*****.**", "admin", is_staff=True, is_superuser=True) cls.user_staff = create_user("staff", "*****@*****.**", "staff", is_staff=True) cls.user_normal = create_user("normal", "*****@*****.**", "normal") cls.site_1 = Site.objects.get(pk=1) cls.site_2 = Site.objects.create(domain="http://example2.com", name="example 2")
def _helper_patch(*args, **kwargs): from django.core.management import call_command from djangocms_helper import utils call_command('migrate', run_syncdb=True) utils.create_user('normal', '*****@*****.**', 'normal', is_staff=True, base_cms_permissions=True, permissions=['view_page'])
def setUpClass(cls): cls.request_factory = RequestFactory() cls.user = create_user('admin', '*****@*****.**', 'admin', is_staff=True, is_superuser=True) cls.user_staff = create_user('staff', '*****@*****.**', 'staff', is_staff=True) cls.user_normal = create_user('normal', '*****@*****.**', 'normal')
def create_super_user(self, user_name, user_password): super_user = create_user( username=user_name, email='*****@*****.**', password=user_password, is_superuser=True, ) return super_user
def test_create_user(self): from django.conf import settings if 'cms' not in settings.INSTALLED_APPS: raise unittest.SkipTest('django CMS not available, skipping test') user = create_user('random', '*****@*****.**', 'random', base_cms_permissions=True, permissions=['add_placeholder']) self._login_context = self.login_user_context(user) self._login_context.user.has_perm('add_placeholdr') self._login_context.user.has_perm('add_text')
def setUp(self): super(TestFAQWizard, self).setUp() username = '******' password = '******' self.admin_user = create_user( username=username, email='*****@*****.**', password=password, is_superuser=True, ) self.client.login(username=username, password=password)
def test_create_user(self): from django.conf import settings if 'cms' not in settings.INSTALLED_APPS: raise unittest.SkipTest( 'django CMS not available, skipping test') user = create_user('random', '*****@*****.**', 'random', base_cms_permissions=True, permissions=['add_placeholder']) self._login_context = self.login_user_context(user) self._login_context.user.has_perm('add_placeholdr') self._login_context.user.has_perm('add_text')
def get_request(self): page = create_page(u'page one', 'fullwidth.html', language='en') page.publish('en') path = page.get_absolute_url() admin_user = create_user('admin', '*****@*****.**', 'admin', is_staff=True, is_superuser=True) request = RequestFactory().get(path) request.current_page = page request.user = admin_user request.session = {} mid = ToolbarMiddleware() mid.process_request(request) return request
def setUpClass(cls): cls.request_factory = RequestFactory() if not User.objects.filter(username='******').count(): cls.user = create_user('normal', '*****@*****.**', 'normal') cls.site1 = Site.objects.get(pk=1)
def setUpClass(cls): cls.request_factory = RequestFactory() cls.user = create_user('normal', '*****@*****.**', 'normal') cls.site1 = Site.objects.get(pk=1)