Add local auth provider (#14365)
* Add local auth provider * Lint * Docstring
This commit is contained in:
1 parent
6e831138b4
commit
ea01b127c2
7 files changed
+501
-36
No files matched your search
@@ -19,7 +19,7 @@ def store():
|
||||
@pytest.fixture
|
||||
def provider(store):
|
||||
"""Mock provider."""
|
||||
return insecure_example.ExampleAuthProvider(store, {
|
||||
return insecure_example.ExampleAuthProvider(None, store, {
|
||||
'type': 'insecure_example',
|
||||
'users': [
|
||||
{
|
||||
@@ -64,20 +64,16 @@ async def test_match_existing_credentials(store, provider):
|
||||
|
||||
async def test_verify_username(provider):
|
||||
"""Test we raise if incorrect user specified."""
|
||||
with pytest.raises(auth.InvalidUser):
|
||||
await provider.async_get_or_create_credentials({
|
||||
'username': 'non-existing-user',
|
||||
'password': 'password-test',
|
||||
})
|
||||
with pytest.raises(insecure_example.InvalidAuthError):
|
||||
await provider.async_validate_login(
|
||||
'non-existing-user', 'password-test')
|
||||
|
||||
|
||||
async def test_verify_password(provider):
|
||||
"""Test we raise if incorrect user specified."""
|
||||
with pytest.raises(auth.InvalidPassword):
|
||||
await provider.async_get_or_create_credentials({
|
||||
'username': 'user-test',
|
||||
'password': 'incorrect-password',
|
||||
})
|
||||
with pytest.raises(insecure_example.InvalidAuthError):
|
||||
await provider.async_validate_login(
|
||||
'user-test', 'incorrect-password')
|
||||
|
||||
|
||||
async def test_utf_8_username_password(provider):
|
||||
|
||||
Reference in new issue
Block a user