示例#1
0
async def profile_with_reserved_wish(event_loop, app, cli,
                                     profile_with_wish_and_product):
    sponsor_vk_id = random.randint(1, 1000000000)
    print('vk_id sponsor ', sponsor_vk_id)
    sponsor_prof = Profile(vk_id=sponsor_vk_id)
    await sponsor_prof.save()

    sponsor_url = gen_vk_url(sponsor_vk_id, APP_SECRET)

    respose = await cli.post('/auth', json={'url': sponsor_url})
    sponsor_cookie = respose.cookies[COOKIE_NAME]
    sponsor_cookie_data = {'value': sponsor_cookie.value}

    dest_prof, product = profile_with_wish_and_product

    res = await cli.post('/profile/mypage/intentions',
                         cookies=sponsor_cookie_data,
                         json={
                             'product_id': product._id,
                             'dest_id': dest_prof.vk_id
                         })
    assert res.status == 201

    yield dest_prof

    await sponsor_prof.delete()
示例#2
0
async def valid_cookie(event_loop, app, cli):
    vk_id = random.randint(1, 1000000000)
    print('cookie id ', vk_id)
    url = gen_vk_url(vk_id, APP_SECRET)

    respose = await cli.post('/auth', json={'url': url})
    cookie = respose.cookies[COOKIE_NAME]
    cookie_data = {'value': cookie.value}

    yield cookie_data

    await Profile.objects.delete(vk_id=vk_id)
示例#3
0
async def profile_with_wish_and_product(event_loop, app, cli,
                                        new_product_mongo):
    vk_id = random.randint(1, 1000000000)
    print('vk_id wont ', vk_id)
    prof = Profile(vk_id=vk_id)
    await prof.save()

    url = gen_vk_url(vk_id, APP_SECRET)

    respose = await cli.post('/auth', json={'url': url})
    dest_cookie = respose.cookies[COOKIE_NAME]
    dest_cookie_data = {'value': dest_cookie.value}

    res = await cli.post('/profile/mypage/wishes',
                         cookies=dest_cookie_data,
                         json={'product_id': new_product_mongo._id})
    assert res.status == 201

    yield prof, new_product_mongo

    await prof.delete()