Exemple #1
0
def test_logins():
	resp = app.request('/login')
	assert_response(resp, status='401 Unauthorized')
	# Shouldn't authorize when there's no login!
	
	# Check should authorize when there is though you silly goose.
	data = {'username': '******','password': '******'}
	resp = app.request('/login', method="POST", data=data)
Exemple #2
0
def test_index():
	resp = app.request('/')
	assert_response(resp, status='303')
	
	resp = app.request('/login')
	assert_response(resp, status = '401')
	
	
Exemple #3
0
def test_index():
	# check that we get a 303 See Other on the / URL
	resp = app.request("/")
	assert_response(resp, status="303 See Other")
	
	# test your first GET request to /hello
	resp = app.request("/hello")
	assert_response(resp)
	
Exemple #4
0
def test_index():
    global client
    resp = client.get('/')
    assert_response(resp, status=302)  #root url should give back a redirect

    resp = client.get('/game')
    assert_response(resp)  #just make sure we got a valid response

    resp = client.post('/game')
    assert_response(resp, contains="You Died!")

    # Go to another scene in the game
    testdata = {'userinput': 'south'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="The Oasis")

    # From there, go to yet another scene in the game
    testdata = {'userinput': 'yes'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="The Tribe of Cajun")
Exemple #5
0
def test_index():
    global client
    resp = client.get('/')  # with this client you can do all kinds of stuff
    assert_response(resp,
                    status=302)  # the root url should give back a redirect

    resp = client.get('/game')
    assert_response(resp)  # just make sure we got a valid response

    resp = client.post('/game')  # use POST, but provide no data
    assert_response(resp, contains="You Died!")

    # Go to another scene in the game
    testdata = {'userinput': 'tell a joke'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Laser Weapon Armory")

    # From there, go to yet another scene
    testdata = {'userinput': '132'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="The Bridge")
Exemple #6
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 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")
Exemple #7
0
def test_index():
    # check for a 404 on / URL
    resp = app.request("/")
    assert_response(resp, status="404")

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

    # make sure default values work for game start
    resp = app.request("/game", method = "POST")
    assert_response(resp, contains = "central_corridor")

    # test for expected values
    data = {'name': 'shazbot', 'greet': 'sandraker'}
    resp = app.request("/hello", method = "POST", data = data)
    assert_response(resp, contains = "shazbot")
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")
Exemple #9
0
def test_index():
    # check for a 404 on / URL
    resp = app.request("/")
    assert_response(resp, status="404")

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

    # make sure default values work for game start
    resp = app.request("/game", method="POST")
    assert_response(resp, contains="central_corridor")

    # test for expected values
    data = {'name': 'shazbot', 'greet': 'sandraker'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="shazbot")
Exemple #10
0
def test_index():
    # check that we get a 404 on the /none URL
    # app is app.py's variable
    resp = app.request("/none")
    assert_response(resp, status="404")

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

    resp = app.request("/game")
    assert_response(resp)
Exemple #11
0
def test_index():
    global client  # let python know you want to use the global client variable in this function
    # Check that we get a 404 on the / URL
    resp = client.get('/')
    assert_response(resp, status=404)

    # test to make sure a GET request to /hello works (returns a 200 status code)
    resp = client.get('/hello')
    assert_response(resp)

    # make sure the default values work when POST has no data
    resp = client.post('/hello')
    assert_response(
        resp, contains="Nobody")  # the request should contain “Hello, Nobody!”

    # test that we get an expected response for specific input data
    testdata = {'name': 'Jon', 'greet': 'Hola'}
    resp = client.post('/hello', data=testdata)
    assert_response(resp,
                    contains="Jon")  # the request should contain “Hola, Jon!”
def test_index():


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

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

    # test that we get expected values
    data = {'username': '******','make': 'Toyota', 'model': 'Camry', 'email': '*****@*****.**', 'minYear': '2007', 'maxYear': '2015', 'minPrice': '500', 'maxPrice': '100000', 'currentTime': 'tempcurrentTime'}
    resp = app.request("/", method="POST", data=data)
    assert_response(resp, contains="alan")
Exemple #13
0
def test_index():
    # check that we get a response 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)
    
    data = {"action": "shoot!"}
    resp = app.request("/game", method="POST", data=data)
    assert_response(resp,status="303")
	# assert_response(resp, status="303", contains="death")
	
	
    # test that we get expected Values
    # data = {'name': 'Zed', 'greet': 'Hola'}
    # resp = app.request("/hello", method="POST", data=data)
    # assert_response(resp, contains="Zed")
    
	
Exemple #14
0
def test_index():

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

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

    # test that we get expected values
    data = {
        'username': '******',
        'make': 'Toyota',
        'model': 'Camry',
        'email': '*****@*****.**',
        'minYear': '2007',
        'maxYear': '2015',
        'minPrice': '500',
        'maxPrice': '100000',
        'currentTime': 'tempcurrentTime'
    }
    resp = app.request("/", method="POST", data=data)
    assert_response(resp, contains="alan")
Exemple #15
0
def test_index():
    global client

    resp = client.get('/')  # With this client you can do all kinds of stuff
    assert_response(resp, contains="In which world do you want to dive into?")

    resp = client.post('/')
    assert_response(resp,
                    contains="something's not working out correctly",
                    status=400)

    testdata = {'chooseworld': '0'}
    resp = client.post('/', data=testdata)
    assert_response(resp, status=302)

    resp = client.post('/game')  # Use POST, but provide no data
    assert_response(resp,
                    contains="something's not working out correctly",
                    status=400)

    resp = client.get('/game')
    assert_response(resp, contains="Prologue")

    testdata = {'userinput': 'wake up'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="I don't know what that means")

    testdata = {'userinput': 'stay under the blanket'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="be able to wake up in the real world")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Prologue")

    testdata = {'userinput': 'open his eyes'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Bunny?")

    testdata = {'userinput': 'bedroom'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="As Billy closes the door")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'open his eyes'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': 'bathroom'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Flashlight Mission")

    testdata = {'userinput': 'pacman'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Billy goes over to the drawer")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'open his eyes'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'bathroom'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': 'orange'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Billy throws the orange")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'open his eyes'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'bathroom'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': 'tablecloth'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Home Office")

    testdata = {'userinput': 'no kill'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="em all!")

    testdata = {'userinput': 'pokeball'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Billy throws the Pokeball")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'open his eyes'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'bathroom'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'tablecloth'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'no kill'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': 'finish him!'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Billy can finally wake up")

    testdata = {'chooseworld': '1'}
    resp = client.post('/', data=testdata)
    assert_response(resp, status=302)

    resp = client.get('/game')
    assert_response(resp, contains="Central Corridor")

    testdata = {'userinput': 'shoot!'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Death...")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Central Corridor")

    testdata = {'userinput': 'dodge!'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Death...")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': 'tell a joke'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Laser Weapon Armory")

    testdata = {'userinput': '589'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Death...")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'tell a joke'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': '123'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="The Bridge")

    testdata = {'userinput': 'throw the bomb'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Death...")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'tell a joke'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': '123'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': 'slowly place the bomb'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="Escape Pod")

    testdata = {'userinput': '14'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="You jump into a random pod")

    testdata = {'userinput': 'start'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'tell a joke'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': '123'}
    resp = client.post('/game', data=testdata)
    testdata = {'userinput': 'slowly place the bomb'}
    resp = client.post('/game', data=testdata)

    testdata = {'userinput': '2'}
    resp = client.post('/game', data=testdata)
    assert_response(resp, contains="You made it")