@@ -0,0 +1,1010 @@
+%22%22%22test_auth.py%22%22%22%0Aimport jwt%0Aimport pytest%0A%0Aimport auth%0Afrom models import ApiKey%0Afrom settings import settings%0A%0A%0A@pytest.fixture(scope='function')%0Adef token():%0A    return jwt.encode(%7B'user': 'tester'%7D, settings.JWT_SECRET)%0A%0A%0A@pytest.fixture(scope='function')%0Adef api_key():%0A    yield ApiKey.objects.create(user='test_me').api_key%0A    ApiKey.objects.all().delete() %0A%0A%0Adef test_token_verify(token):%0A    %22%22%22test token auth verify%22%22%22%0A    assert auth.token_verify(token) == %7B'user': 'tester'%7D%0A    token = jwt.encode(%7B'user': 'invalid'%7D, 'not-the-real-secret')%0A    assert auth.token_verify(token) is False%0A%0A%0Adef test_api_key_verify(api_key):%0A    %22%22%22test api_key auth verify%22%22%22%0A    assert auth.api_key_verify(api_key).user == 'test_me'%0A    assert auth.api_key_verify('invalid-api-key') is False%0A%0A%0Adef test_multi_verify(token, api_key):%0A    assert auth.multi_verify(token, api_key) == %7B'user': 'tester'%7D%0A    assert auth.multi_verify(None, api_key).user == 'test_me'%0A    assert auth.multi_verify(None, None) is None%0A%0A

add auth tests