Example #1
0
def test_simple():
    wfc = workflow_connector()
    session = MockSessionStore()
    req = make_request(session)
    resp = DotDict()
    wfc.on_post(req, resp=resp, wf_name='simple_login')
    assert req['context']['result']['forms'] == get_form('student_login_form')
    req= make_request(session, cmd='do', login_crd={'username':'******', 'password':'******'})
    pprint(session)
    wfc.on_post(req, resp=DotDict(), wf_name='simple_login')
    # print(session)
    # print(req)
    assert session['user']['username'] == 'user'
    assert req['context']['result']['dashboard'] == 'Dashboard'
Example #2
0
def test_add_user_then_login():
    User.objects._clear_bucket()
    sleep(1)
    u = User(username='******')
    u.set_password('123')
    u.save()
    sleep(1)
    wfc = workflow_connector()
    session = MockSessionStore()
    req = make_request(session)
    resp = DotDict()
    wfc.on_post(req, resp=resp, wf_name='simple_login')
    assert req['context']['result']['forms'] == LoginForm(types={"password": "******"}).serialize()
    req = make_request(session, cmd='do',
                       login_crd={'username': '******', 'password': '******'})
    wfc.on_post(req, resp=DotDict(), wf_name='simple_login')
    assert session['user_id'] == u.key
    assert req['context']['result']['screen'] == 'dashboard'