def test_random_source(self, authenticate_mock): backend = MozilliansAuthBackend() request_mock = Mock() request_mock.META = {'HTTP_REFERER': settings.SITE_URL + '/?source=foobar'} backend.request = request_mock backend.authenticate(request=request_mock) eq_(backend.referral_source, None)
def test_get_involved_source(self, authenticate_mock): backend = MozilliansAuthBackend() request_mock = Mock() request_mock.META = {'HTTP_REFERER': settings.SITE_URL + '/?source=contribute'} backend.request = request_mock backend.authenticate(request=request_mock) eq_(backend.referral_source, 'contribute')
def test_random_source(self, authenticate_mock): backend = MozilliansAuthBackend() request_mock = Mock() request_mock.META = { 'HTTP_REFERER': settings.SITE_URL + '/?source=foobar' } backend.request = request_mock backend.authenticate(request=request_mock) eq_(backend.referral_source, None)
def test_get_involved_source(self, authenticate_mock): backend = MozilliansAuthBackend() request_mock = Mock() request_mock.META = { 'HTTP_REFERER': settings.SITE_URL + '/?source=contribute' } backend.request = request_mock backend.authenticate(request=request_mock) eq_(backend.referral_source, 'contribute')