def test_reset():
    'testing functionability of passwordreset request'

    workspace_reset()
    reset_store = get_reset_code_store()

    reg_user1()

    auth.request({'email': '*****@*****.**'})

    for i in reset_store:
        if i['email'] == '*****@*****.**':
            code = i['reset_code']

    auth.reset({'reset_code': code, 'new_password': '******'})

    auth_store = get_auth_data_store()

    password_check = 0  #if new password is in auth store let = 1

    for i in auth_store:
        if i['password'] == 'thisiscool':
            password_check = 1

    assert password_check == 1
def test_invalid_password():
    'error case'

    workspace_reset()

    reg_user1()

    reset_code = id_generator()

    auth.request({'email': '*****@*****.**'})

    with pytest.raises(InputError):
        auth.reset({'reset_code': reset_code, 'new_password': '******'})
def test_invalid_resetcode():
    'error case'

    workspace_reset()

    reg_user1()

    auth.request({'email': '*****@*****.**'})

    with pytest.raises(InputError):
        auth.reset({
            'reset_code': 'ABCD',
            'new_password': '******'
        })  #pylint disable = C0304
示例#4
0
def test_request():

    'testing functionability of passwordreset request'

    workspace_reset()
    reg_user1()  #pylint disable = W0612

    auth.request({'email': '*****@*****.**'})

    reset_store = get_reset_code_store()

    email_match = 0  #if found = 1

    for i in reset_store:
        if i['email'] == '*****@*****.**':
            email_match = 1

    assert email_match == 1  #pylint disable = R0123
示例#5
0
    def fetch(url):
        r = request('GET', url)
        json = r.json()
        parsed_tracks = map(parse, json['items'])
        tracks.extend(parsed_tracks)

        next = json['next']
        if (next):
            fetch(next)
示例#6
0
def play(uri):
    request('PUT',
            'https://api.spotify.com/v1/me/player/play',
            json={'uris': [uri]})
示例#7
0
 def exit_handler():
     rmtree(temp_dir)
     request('PUT', 'https://api.spotify.com/v1/me/player/pause')