add tests to konviva
This commit is contained in:
@@ -35,7 +35,7 @@ def token(username: str) -> KonvivaToken:
|
||||
r.raise_for_status()
|
||||
|
||||
# Because Konviva does not return the proper HTTP status code
|
||||
if err := glom(r.json(), 'errors.0', default=None):
|
||||
if err := glom(r.json(), 'errors', default=None):
|
||||
raise KonvivaError(err)
|
||||
|
||||
return KonvivaToken(**r.json())
|
||||
|
||||
@@ -23,7 +23,7 @@ Globals:
|
||||
Architectures:
|
||||
- x86_64
|
||||
Layers:
|
||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:68
|
||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:72
|
||||
Environment:
|
||||
Variables:
|
||||
TZ: America/Sao_Paulo
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import pytest
|
||||
|
||||
import konviva
|
||||
from config import KONVIVA_API_URL
|
||||
|
||||
@@ -9,3 +11,8 @@ def test_konviva_token():
|
||||
|
||||
redirect_uri = konviva.redirect_uri(token)
|
||||
assert KONVIVA_API_URL in redirect_uri
|
||||
|
||||
|
||||
def test_konviva_token_error():
|
||||
with pytest.raises(konviva.KonvivaError):
|
||||
konviva.token('sergio@doesnotexist.com')
|
||||
|
||||
Reference in New Issue
Block a user