Пример #1
0
def test_index_with_session(mock_request,mock_db):
    mock_request.get_cookie = MagicMock(return_value='session')
    global db
    mock_db.return_value = db
    mock_db.attached_devices = MagicMock(return_value="attached_devices")
    resp = wsgi.index()
    print resp
    for device in resp['attached_devices']:
        device.pop('_id')
    resp['userinfo'].pop('_id')
    assert resp =={u'attached_devices': [{u'email': u'*****@*****.**', u'attatched_devices': u'nexus'}], u'userinfo': {u'token_hash': u'session', u'id': u'12', u'email': u'*****@*****.**'}}
Пример #2
0
def test_index_without_login():
    try:
        wsgi.index()
    except HTTPResponse as e:
        assert e._headers['Location']==['http://127.0.0.1/google/login']