Example #1
0
def test_bad_login_response_data():
    with pytest.raises(ers.ErsInvalidResponse):
        token = ers.login('json2',
                          'json2',
                          secret='46b5bdef021a6d1c',
                          url='http://ers/json2api')
Example #2
0
def test_bad_creds():
    with pytest.raises(ers.ErsInvalidLogin) as exc:
        token = ers.login('', '')
Example #3
0
def test_bad_login_response_format():
    with pytest.raises(ers.ErsInvalidLogin):
        token = ers.login('json',
                          'json',
                          secret='46b5bdef021a6d1c',
                          url='http://ers/xmlapi')
Example #4
0
def test_bad_url():
    with pytest.raises(ers.ErsUnavailable) as exc:
        token = ers.login('user', 'pass', url='http://isnothere/api')
Example #5
0
def test_bad_login():
    with pytest.raises(ers.ErsInvalidLogin):
        token = ers.login('json',
                          'json',
                          secret='46b5bdef021a6d1c',
                          url='http://ers/noauth')
Example #6
0
def test_login():
    token = ers.login('username',
                      'password',
                      secret='46b5bdef021a6d1c',
                      url='http://ers/api')
    assert isinstance(token, str)
Example #7
0
def verify_user(user_id, key):
    """ TODO: docstring """
    token = ers.login(user_id, key)
    if token:
        return ers.roles(token)