예제 #1
0
def test_index():
    # check that we get a 404 on the / URL
    resp = app.request("/")
    assert_response(resp, status="404")

    # test our first GET request to/hello
    resp = app.request("/hello")
    assert_response(resp)

    # make sure default values will work for the form
    resp = app.request("/hello", method="POST")
    assert_response(resp, contains="NOBODY")

    # test that we get expected values
    data = {'name': 'Zahid', 'greet': 'hello'}
    resp = app.request('/hello', method="POST", data=data)
    assert_response(resp, contains="Zahid")
예제 #2
0
파일: app_tests.py 프로젝트: karagdon/pypy
def test_index():
	#check that we got a 404 on the / URL
	resp = app.request("/")
	assert_response(resp, status="404")
	
	#test our first GET requst to /hello
	resp = app.request("/hello")
	assert_response(resp)
	
	#make sure default values work for theform
	resp = app.request("/hello", method="POST")
	assert_response(resp, contains="Nobody")
	
	#test that we got expected values
	data = {'name': 'Zed', 'greet': 'Hola'}
	resp = app.request("/hello", method="POST", data=data)
	assert_response(resp, contains="Zed")
def test_index():
    # check that we get a 404 on the / URL
    resp = app.request("/")
    assert_response(resp, status="404")

    # test our first GET request to /hello
    resp = app.request("/hello")
    assert_response(resp)

    # make sure default values work for the form
    resp = app.request("/hello", method='POST')
    assert_response(resp, contains="Nobody")

    # test that we get expected values
    data = {'name': 'Zed', 'greet': 'Hola'}
    resp = app.request("/hello", method='POST', data=data)
    assert_response(resp, contains="Zed")
예제 #4
0
def test_index():
    # check that we get a 303 on the / URL
    resp = app.request("/")
    assert_response(resp, status="303")

    # test our first GET request to /game
    resp = app.request("/game")
    assert_response(resp)

    # test that we POST request to /game
    data = {'action': 'tell a joke'}
    resp = app.request("/game", method='POST', data=data)
    assert_response(resp, status='303')
예제 #5
0
def test_SayHello():
    # test our first GET request to /hello
    resp = app.request("/hello")
    assert_response(resp)

    # make sure default values work for the form
    resp = app.request("/hello", method="POST")
    assert_response(resp, contains="Nobody")

    # test that we get expected values
    data = {'name': 'Zed', 'greet': 'Hola'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Zed")
예제 #6
0
def test_SayHello():
    # test our first GET request to /hello
    resp = app.request("/hello")
    assert_response(resp)

    # make sure default values work for the form
    resp = app.request("/hello", method="POST")
    assert_response(resp, contains="Nobody")

    # test that we get expected values
    data = {'name': 'Zed', 'greet': 'Hola'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Zed")
예제 #7
0
def test_Index():
    # check that we get a 404 on the / URL
    resp = app.request("/")
    assert_response(resp)
예제 #8
0
def test_Index():
    # check that we get a 404 on the / URL
    resp = app.request("/")
    assert_response(resp)