Пример #1
0
 def test_autocompeter_different_domain(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     result = autocompeter(request)
     eq_(result['autocompeter_domain'], '')
     with self.settings(AUTOCOMPETER_DOMAIN='airmo'):
         result = autocompeter(request)
         eq_(result['autocompeter_domain'], 'airmo')
Пример #2
0
 def test_autocompeter_different_domain(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     result = autocompeter(request)
     eq_(result['autocompeter_domain'], '')
     with self.settings(AUTOCOMPETER_DOMAIN='airmo'):
         result = autocompeter(request)
         eq_(result['autocompeter_domain'], 'airmo')
Пример #3
0
 def test_autocompeter_different_url(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     result = autocompeter(request)
     # this has a default in tests
     eq_(result['autocompeter_url'], settings.AUTOCOMPETER_URL)
     with self.settings(AUTOCOMPETER_URL='http://autocompeter.dev/v1'):
         result = autocompeter(request)
         eq_(result['autocompeter_url'], 'http://autocompeter.dev/v1')
Пример #4
0
 def test_autocompeter_different_url(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     result = autocompeter(request)
     # this has a default in tests
     eq_(result['autocompeter_url'], settings.AUTOCOMPETER_URL)
     with self.settings(AUTOCOMPETER_URL='http://autocompeter.dev/v1'):
         result = autocompeter(request)
         eq_(result['autocompeter_url'], 'http://autocompeter.dev/v1')
Пример #5
0
 def test_autocompeter_contributor(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(username='******')
     UserProfile.objects.create(
         user=request.user,
         contributor=True,
     )
     result = autocompeter(request)
     eq_(result['autocompeter_groups'],
         '%s' % (Event.PRIVACY_CONTRIBUTORS, ))
Пример #6
0
 def test_autocompeter_employee(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(
         username='******'
     )
     result = autocompeter(request)
     eq_(
         result['autocompeter_groups'],
         '%s,%s' % (Event.PRIVACY_CONTRIBUTORS, Event.PRIVACY_COMPANY)
     )
Пример #7
0
 def test_autocompeter_contributor(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(
         username='******'
     )
     UserProfile.objects.create(
         user=request.user,
         contributor=True,
     )
     result = autocompeter(request)
     eq_(
         result['autocompeter_groups'],
         '%s' % (Event.PRIVACY_CONTRIBUTORS,)
     )
Пример #8
0
 def test_autocompeter_employee(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(username='******')
     result = autocompeter(request)
     eq_(result['autocompeter_groups'],
         '%s,%s' % (Event.PRIVACY_CONTRIBUTORS, Event.PRIVACY_COMPANY))
Пример #9
0
 def test_autocompeter_anonymous(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     result = autocompeter(request)
     eq_(result['autocompeter_groups'], '')
Пример #10
0
 def test_autocompeter_disabled(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     with self.settings(AUTOCOMPETER_KEY=None):
         result = autocompeter(request)
         eq_(result, {})
Пример #11
0
 def test_autocompeter_anonymous(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     result = autocompeter(request)
     eq_(result['autocompeter_groups'], '')
Пример #12
0
 def test_autocompeter_disabled(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     with self.settings(AUTOCOMPETER_KEY=None):
         result = autocompeter(request)
         eq_(result, {})