示例#1
0
def test_not_owned_shot_with_fxa_auth():
    setup_session_1 = setup_shot_on_device()
    shot_url = setup_session_1['shot_url']

    setup_session_2 = setup_shot_on_device()
    browser_only_user = ScreenshotsBase()

    # Use setup_session_2 accountId to login to a browser only session
    result = browser_only_user.login(setup_session_2['user'].accountId)
    assert setup_session_2['user'].deviceId == result[
        'deviceid'], "Associated deviceId should match"

    # Read !owned shot created in first setup session
    browser_only_user.read_shot(shot_url)

    # set expiration and delete on the shot should throw 404
    try:
        try:
            browser_only_user.set_expiration(shot_url, 1)
            assert False, "set_expiration should fail"
        except HTTPError, e:
            if e.response.status_code != 404:
                raise

        try:
            browser_only_user.delete_shot(shot_url)
            assert False, "delete_shot should fail"
        except HTTPError, e:
            if e.response.status_code != 404:
                raise
def test_not_owned_shot_with_fxa_auth():
    setup_session_1 = setup_shot_on_device()
    shot_url = setup_session_1['shot_url']

    setup_session_2 = setup_shot_on_device()
    browser_only_user = ScreenshotsBase()

    # Use setup_session_2 accountId to login to a browser only session
    result = browser_only_user.login(setup_session_2['user'].accountId)
    assert setup_session_2['user'].deviceId == result['deviceid'], "Associated deviceId should match"

    # Read !owned shot created in first setup session
    browser_only_user.read_shot(shot_url)

    # set expiration and delete on the shot should throw 404
    try:
        try:
            browser_only_user.set_expiration(shot_url, 1)
            assert False, "set_expiration should fail"
        except HTTPError, e:
            if e.response.status_code != 404:
                raise

        try:
            browser_only_user.delete_shot(shot_url)
            assert False, "delete_shot should fail"
        except HTTPError, e:
            if e.response.status_code != 404:
                raise
def test_owned_shot_with_fxa_auth():
    setup_session = setup_shot_on_device()
    shot_url = setup_session['shot_url']
    browser_only_user = ScreenshotsBase()

    # Use accountId used on device to setup to login to a browser only session
    result = browser_only_user.login(setup_session['user'].accountId)
    assert setup_session['user'].deviceId == result['deviceid'], "Associated deviceId should match"

    # Read shot page to check if browser_only_user can set expiration and delete shot
    page = browser_only_user.read_shot(shot_url)
    browser_only_user.set_expiration(shot_url, 1)
    time.sleep(2)
    expired_page = browser_only_user.read_shot(shot_url)
    # An expired page happens to be unparseable:
    assert expired_page["clip_content"] is None
    get_url(page["clip_url"], expect=404)
    get_url(shot_url, expect=200)
    browser_only_user.delete_shot(shot_url)  # cleanup
    setup_session['user'].delete_account()
示例#4
0
def test_owned_shot_with_fxa_auth():
    setup_session = setup_shot_on_device()
    shot_url = setup_session['shot_url']
    browser_only_user = ScreenshotsBase()

    # Use accountId used on device to setup to login to a browser only session
    result = browser_only_user.login(setup_session['user'].accountId)
    assert setup_session['user'].deviceId == result[
        'deviceid'], "Associated deviceId should match"

    # Read shot page to check if browser_only_user can set expiration and delete shot
    page = browser_only_user.read_shot(shot_url)
    browser_only_user.set_expiration(shot_url, 1)
    time.sleep(2)
    expired_page = browser_only_user.read_shot(shot_url)
    # An expired page happens to be unparseable:
    assert expired_page["clip_content"] is None
    get_url(page["clip_url"], expect=404)
    get_url(shot_url, expect=200)
    browser_only_user.delete_shot(shot_url)  # cleanup
    setup_session['user'].delete_account()