Exemplo n.º 1
0
 def test_custom_authentication_policy(self):
     backend = MozilliansAuthBackend()
     body = '{"count": 1, "results": [{"_url": "http://example.com/api/v2/users/1"}]}'
     url = urljoin(backend.mozillians_client.base_url, 'users')
     responses.add(responses.GET, url=url, body=body, status=200,
                   content_type='application/json')
     ok_(not backend.is_valid_email('*****@*****.**'))
Exemplo n.º 2
0
 def test_invalid_email(self):
     backend = MozilliansAuthBackend()
     body = '{"count": 0, "results": []}'
     url = urljoin(backend.mozillians_client.base_url, 'users')
     responses.add(responses.GET, url=url, body=body, status=200,
                   content_type='application/json')
     ok_(not backend.is_valid_email('*****@*****.**'))
Exemplo n.º 3
0
 def test_valid_email(self):
     backend = MozilliansAuthBackend()
     body = '{"count": 1, "results": [{"_url": "http://example.com/api/v2/users/1"}]}'
     url = urljoin(backend.mozillians_client.base_url, 'users')
     responses.add(responses.GET, url=url, body=body, status=200,
                   content_type='application/json')
     ok_(backend.is_valid_email('*****@*****.**'))
Exemplo n.º 4
0
 def test_normalize_mixed_case_email(self):
     email = '*****@*****.**'
     backend = MozilliansAuthBackend()
     normalized_email = backend._normalize_email(email)
     eq_(normalized_email, '*****@*****.**')
Exemplo n.º 5
0
 def test_normalize_lower_case_email(self):
     email = '*****@*****.**'
     backend = MozilliansAuthBackend()
     normalized_email = backend._normalize_email(email)
     eq_(normalized_email, '*****@*****.**')
Exemplo n.º 6
0
 def test_mozillians_client(self):
     backend = MozilliansAuthBackend()
     eq_(backend.mozillians_client.key, 'EXAMPLE_API_KEY')
     eq_(backend.mozillians_client.base_url, 'http://example.com/api/v2/')