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