Beispiel #1
0
def test_login(app_url, uuid):
    login_resp = requests.post(app_url + '/login',
                               json={
                                   'email': '*****@*****.**',
                                   'password': '******'
                               })
    assert login_resp.ok
    assert login_resp.headers['access'] is not None

    cookie = SimpleCookie()
    cookie.load(login_resp.headers['Set-Cookie'])
    assert cookie.get('refresh_token') is not None
    assert verify_jwt(login_resp.headers['access'],
                      cookie.get('refresh_token').value,
                      app_url + '/gen-keys/jwk', ['ES256'], uuid,
                      'Aureole Server')

    refresh_resp = requests.post(app_url + '/refresh',
                                 cookies=login_resp.cookies)
    assert refresh_resp.ok
    assert refresh_resp.headers['access'] is not None
    assert verify_jwt(refresh_resp.headers['access'],
                      cookie.get('refresh_token').value,
                      app_url + '/gen-keys/jwk', ['ES256'], uuid,
                      'Aureole Server')
Beispiel #2
0
def test_login(app_url, uuid):
    r = requests.post(app_url + '/phone/send', json={'phone': '+380711234567'})
    assert r.ok
    otp_id = r.json()['verification_id']

    otps = requests.get(
        'https://twilio/2010-04-01/Accounts/123456/Messages.json',
        verify=False)
    otp = otps.json()[0]['Body']
    print(otp)
    r = requests.post(app_url + '/phone/login',
                      json={
                          'otp_id': otp_id,
                          'otp': otp
                      })
    assert r.ok
    assert r.headers['access'] is not None
    assert r.headers['Set-Cookie'] is not None

    cookie = SimpleCookie()
    cookie.load(r.headers['Set-Cookie'])
    assert cookie.get('refresh_token') is not None
    assert verify_jwt(r.headers['access'],
                      cookie.get('refresh_token').value,
                      BASE_URL + '/phone-pwless-jwk-file/jwk', ['RS256'], uuid,
                      'Aureole Server')

    requests.delete('https://twilio/2010-04-01/Accounts/123456/Messages.json',
                    verify=False)
Beispiel #3
0
def test_facebook_login(app_url, uuid):
    r = requests.get(app_url + '/oauth2/facebook', verify=False)
    print(r.text)
    assert r.ok
    assert r.headers['access'] is not None

    cookie = SimpleCookie()
    cookie.load(r.headers['Set-Cookie'])
    assert cookie.get('refresh_token') is not None
    assert verify_jwt(r.headers['access'],
                      cookie.get('refresh_token').value,
                      app_url + '/social-auth-jwk-file/jwk', ['RS256'], uuid,
                      'Aureole Server')
Beispiel #4
0
def test_login(app_url, uuid):
    r = requests.post(app_url + '/email-link/send',
                      json={'email': '*****@*****.**'})
    assert r.ok

    emails = requests.get('http://smtp:1080/api/emails')
    link = emails.json()[0]['text']
    r = requests.get(link)
    assert r.ok
    assert r.headers['access'] is not None
    assert r.headers['Set-Cookie'] is not None

    cookie = SimpleCookie()
    cookie.load(r.headers['Set-Cookie'])
    assert cookie.get('refresh_token') is not None
    assert verify_jwt(r.headers['access'],
                      cookie.get('refresh_token').value,
                      BASE_URL + '/email-pwless-jwk-file/jwk', ['RS256'], uuid,
                      'Aureole Server')

    requests.delete('http://smtp:1080/api/emails')