def test_game(): #test the first GET request to /game a = code.Password('4', '0', '30', '30') password = a.create() session = 'web.session.Session object at 0x10c742520' resp = app.request("/game") assert_response(resp)
def test_index(): # test our first GET request to /game resp = app.request("/game") assert_response(resp) resp = app.request("/") assert_response(resp, status="303")
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("/game") assert_response(resp)
def test_upload(): # Test 404 on the / URL resp = uploadapp.request("/") assert_response(resp, status="404") # Test GET staute 200 on the /upload URL resp = uploadapp.request("/upload") assert_response(resp)
def test_game(): #check that we get a 200 on /game resp = app.request("/game") assert_response(resp) #check that we have response data on a form submit resp = app.request("/game", method='POST') assert_response(resp, status="303")
def test_helloGET(self, mock_helloGET): mock_helloGET.return_value = render.hello(greeting="hello——GET", another="Another line") resp = app.request("/hello") mock_helloGET.assert_called_once_with() assert_response(resp, status="200") assert_response(resp, contains="Another line")
def test_uploadPOST(self, mock_uploadPOST): mock_uploadPOST.return_value = render.show( filename="/static/nethack.png") resp = app.request(localpart="/image", method='POST') mock_uploadPOST.assert_called_once_with() assert_response(resp, status="200") assert_response(resp, contains="/static/nethack.png")
def test_map_chooser(): global cookie resp = app.request("/load",method = "GET",headers = {'Cookie':cookie} ) assert_response(resp,contains = "List of available games are:",status = "200") cookie = get_session_id(resp) resp = app.request("/load",method = "POST", data = {'mapname':"Gothonweb"},headers = {'Cookie':cookie}) assert_response(resp,status = "303") cookie = get_session_id(resp)
def test_index(): # check that we get a 404 on the / URL resp = app.request("/game") assert_response(resp) # test our first GET request to /hello resp = app.request("/hello") assert_response(resp, status="404")
def test_index(): # test our first GET request to /hello resp = app.request("/you_died") assert_response(resp) # make sure the default values work for the form resp = app.request("/show_room", method="POST") assert_response(resp, contains="Play Agains?")
def checkstuff(action,contains): global cookie resp = app.request("/game",method = "POST",headers = {'Cookie':cookie},data = {'action':action}) assert_response(resp,status = "303") cookie = get_session_id(resp) # GET resp = app.request("/game",headers = {'Cookie':cookie},method = "GET") assert_response(resp,status = "200",contains = contains) cookie = get_session_id(resp)
def test_index(): resp = app.request("/") assert_response(resp, status="303") session_id = get_session_id(resp) headers = {'Cookie': session_id} resp = app.request("/game", headers=headers) print "session_id:%r" % session_id print "resp: %r" % resp assert_response(resp, contains='Central Corridor')
def test_fillformPOST(self, mock_fillformPOST): mock_fillformPOST.return_value = render.hello(greeting="Hi, Grocer", another="Another line") # app的request方法有参数method可以设置为POST,这样将会访问到fillform的POST方法 # 由于前面已经mock了fillform的返回值,所以这里不用指定输入的data,即使指定了也没有用,它将会按mock中规定的值返回。 resp = app.request(localpart="/fillform", method='POST') mock_fillformPOST.assert_called_once_with() assert_response(resp, status="200") assert_response(resp, contains="Hi, Grocer")
def test_index(): # check that we get a 404 on the / URL resp = app.request("/") assert_response(resp, status="303") resp = app.request("/game", method="GET") # test that we get expected values data = {'action': 'dodge!'} resp = app.request("/game", method="POST", data=data) assert_response(resp, status="303")
def test_game1(): data1 = { 'digits': '4', 'complexity': '0', 'goldCoins': '', 'silverCoins': '30' } resp = app.request("/setup", method="POST", data=data1) assert_response( resp, contains="You have to have some amount of Gold coins in your bag.")
def test_Index(): # check that we get a 404 on the / URL resp = app.request("/re") print "resp, index:", resp assert_response(resp, status="404") # test our first GET request to /hello resp = app.request("/") web.ctx.session.save() assert_response(resp, status='303')
def test_Index(): # check that we get a 404 on the / URL resp = app.request("/re") print "resp, index:", resp assert_response(resp, status="404") # test our first GET request to /hello resp = app.request("/") web.ctx.session.save() assert_response(resp, status="303")
def test_family_member_submit(): resp = app.request("/") assert_response(resp, contains="Rajesh Family Trust") resp = app.request("/family_members") assert_response(resp, contains="Family Members") resp = app.request("/family_member") assert_response(resp, contains="Family Member") resp = app.request("/family_member_edit") assert_response(resp, contains="Edit Family Member") resp = app.request("/family_member_submit", method="POST") assert_response(resp, status="303")
def test_GameEngine(): # make sure default values work for the form session = web.config._session # web.header('Set-Cookie', 'webpy_session_id=10a98447e9a79d19513226ea79aed7b2801ee6df; Path=/; httponly') resp = app.request( "/", method="GET" ) #, headers={'Ser-Cookie': 'webpy_session_id=10a98447e9a79d19513226ea79aed7b2801ee6df; Path=/; httponly'} assert_response(resp, contains="Central Corridor") # test that we get expected values data = {'name': 'Zed', 'greet': 'Hola'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Zeed")
def test_GameEngine(): # make sure default values work for the form session = web.config._session # web.header('Set-Cookie', 'webpy_session_id=10a98447e9a79d19513226ea79aed7b2801ee6df; Path=/; httponly') resp = app.request( "/", method="GET" ) # , headers={'Ser-Cookie': 'webpy_session_id=10a98447e9a79d19513226ea79aed7b2801ee6df; Path=/; httponly'} assert_response(resp, contains="Central Corridor") # test that we get expected values data = {"name": "Zed", "greet": "Hola"} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Zeed")
def test_index(): # test our first GET request to /game resp = app.request("/game") assert_response(resp) resp = app.request("/") assert_response(resp, status="303") # 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': 'Jay', 'greet': 'Hiya'} #resp = app.request("/hello", method="POST", data=data) #assert_response(resp, contains="Jay")
def test_family_member_edit(): resp = app.request("/") assert_response(resp, contains="Rajesh Family Trust") resp = app.request("/family_members") assert_response(resp, contains="Family Members") resp = app.request("/family_member") assert_response(resp, contains="Family Member") resp = app.request("/family_member_edit") assert_response(resp, contains="Edit Family Member")
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")
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("/game") assert_response(resp) #make sure default values work for the form #resp = app.request("/game", method="POST") #assert_response(resp, action=None) # test that we get expected values #data = {'name':'Zed','greet':'Hola'} #resp = app.request("/hello", method="POST",data=data) #assert_response(resp,contains="Zed")
def test_index(): resp = app.request("/") assert_response(resp, status="404") resp = app.request("/hello") assert_response(resp) resp = app.request("/hello", method="POST") assert_response(resp, contains="<br/>") # 检查hello_form_laid_out.html中是否包含该值。 resp = app.request("/hello") assert_response(resp, contains="A Greeting:") data = {'name': 'Evan Wong', 'greet': 'Joey Wong'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Evan Wong")
def test_index(): # check that we get a 404 on the / URL resp = app.request("/") assert_response(resp, status="404") # test initial 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 parameters can be passed data = {'name': 'self', 'msg': 'Hola'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="self") assert_response(resp, contains="Hola")
def test_index(): global client resp = client.get('/') assert_response(resp, status=302) resp = client.get('/game') assert_response(resp) resp = client.post('/game') assert_response(resp, contains="You Died!") testdata = {'userinput': 'tell a joke'} resp = client.post('/game', data=testdata) assert_response(resp, contains="Laboratory Door") testdata = {'userinput': '132'} resp = client.post('/game', data=testdata) assert_response(resp, contains="Robot TRex")
def test_index(): #check that we get a 404 on the /hello url resp = app.request("/aaa") assert_response(resp, status="404") #test first get request to / resp = app.request("/game") assert_response(resp) #make sure default values work for the form #resp = app.request("/game", method="POST") #assert_response(resp, contains="*") #this doesnt actually work #test that we get expected values #data = {'name': 'zed', 'greet': 'hola'} #resp = app.request("/", method="POST", data=data) #assert_response(resp, contains="Zed") pass
def test_game(): global cookie # check empty session resp = app.request("/game") assert_response(resp,contains ="Error!",status = "200") # check initial get resp = app.request("/game",headers = {'Cookie':cookie}) assert_response(resp,contains = "Central Corridor",status = "200") cookie = get_session_id(resp) # Using the method we built to check rooms checkstuff("tell a joke","Laser Weapon Armory") x = base64.b64decode(open("sessions/{}".format(cookie[17::]),'r').read()) x = pickle.loads(x) # ^ This gets the rand value of laser_weapon_armory from session variable using cookie # Then decodes and unpickles using base64 and pickle checkstuff("45","Laser Weapon Armory") # ^Checking with a mistake to see if it returns the same room checkstuff(x['rand'],"The Bridge") # ^ Checking with the rand value which should be the solution and return the bridge checkstuff("slowly place the bomb","Escape Pod") checkstuff(x['rand2'],"The End") del cookie ## Initializing another cookie because writing cookie2 = cookie will return the same cookie since address resp = app.request('/',method = "POST",data = {'username':'******','password':'******'}) cookie = get_session_id(resp) resp = app.request("/load",headers = {'Cookie':cookie},method = "POST", data = {'mapname':"Gothonweb"}) assert_response(resp,status = "303") cookie2 = get_session_id(resp) # Checking Screwup input resp2 = app.request("/game",headers = {'Cookie':cookie2}, method = "POST", data = {'action':'dgsdg'}) assert_response(resp2,status = "303") cookie2 = get_session_id(resp2) resp2 = app.request("/game",headers = {'Cookie':cookie2},method = "GET") assert_response(resp2,status = "200",contains = "Death") del cookie2
def test_index(): resp = app.request("/") assert_response(resp, status="404") resp = app.request("/hello") assert_response(resp) resp = app.request("/hello", method="POST") assert_response(resp, contains="Nobody") data = ['name': 'Zed', 'greet': 'Hola'] resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Zed")
def test_index(): resp = app.request("/") assert_response(resp, status='404') resp = app.request("/hello") assert_response(resp) resp = app.request("/hello", method="POST") assert_response(resp, contains="Nobody") 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") ''' resp = app.request("/") assert_response(resp, status="303", contains="")
def test_index(): resp = app.request("/") assert_response(resp, status="404") resp = app.request("/index") assert_response(resp) resp = app.request("/index", method="POST") assert_response(resp, contains="Nobody") data = {'name':'Saisimon', 'greet': 'Hello'} resp = app.request("/index", method="POST", data=data) assert_response(resp, contains="Saisimon")
def test_index(): resp = requests.get("http://localhost:5000/") assert_response(resp, status="404") resp= requests.get("http://localhost:5000/hello") assert_response(resp) resp = requests.get("http://localhost:5000/hello", method="POST") assert_response(resp, contains="Nobody") data = {'name': 'Scott', 'greet': 'Howdy'} resp = requests.get("http://localhost:5000/hello", method="POST", data=data) assert_response(resp, contains="Scott")
def test_index(): resp = app.request("/") assert_response(resp, status="404") resp = app.request("/hello") assert_response(resp) resp = app.request("/hello", method="POST") assert_response(resp, contains="Nobody") data = {'name': 'Hung', 'greet': 'Xin chao'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Hung")
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) # valid response resp = client.post('/game') #POST, but provide no data assert_response(resp, contains="You died!") #Go to another scene 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': code} resp = client.post('/game', data=testdata) assert_response(resp, contains='The Bridge')
def test_index(): resp = app.request("/") assert_response(resp, status="404") resp = app.request("/hello") assert_response(resp) resp = app.request("/hello", method='POST') assert_response(resp, contains="Nobody") data = {'name': 'Zend', 'greet': 'Hola'} resp = app.request("/hello", method='POST', data=data) assert_response(resp, contains="Zed")
def test_index(): resp = app.request('/') assert_response(resp, status='404') resp = app.request('/hello') assert_response(resp) resp = app.request('/hello', method='POST') assert_response(resp, contains='Nobody') data = {'name': 'Zed', 'greet': 'Hola'} resp = app.request('/hello', method='POST', data=data) assert_response(resp, contains='Zed')
def test_index(): resp = app.request("/game") assert_response(resp) resp = app.request("/") assert_response(resp) resp = app.request("/lobby") assert_response(resp) resp = app.request("/help") assert_response(resp)
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/1') assert_response(resp) # just make sure we got a valid response resp = client.post('/game/1') # use POST, but provide no data assert_response(resp, contains="You Died!") # Go to another scene in the game testdata = {'userinput': 'key'} resp = client.post('/game/1', data=testdata) assert_response(resp, contains="The Brain World") # From there, go to yet another scene testdata = {'userinput': '0521'} resp = client.post('/game/1', data=testdata) assert_response(resp, contains="Keypad")
def test_index(): # check that we get a 404 on the /xyz URL resp = app.request("/xyz") assert_response(resp, status="404") # test our first GET request to / resp = app.request("/") assert_response(resp, status="200") # test our first GET request to /fillform resp = app.request("/fillform") assert_response(resp, status="200") # make sure default values work for the form resp = app.request("/fillform", method="POST") assert_response(resp, contains='Nobody') # test that we get expected values data = {'name': 'Oscar', 'greet': 'Hola'} resp = app.request("/fillform", method="POST", data=data) assert_response(resp, contains="Oscar")
def test_path_1(): # Go one path through the game testdata = {'userinput': 'yes'} resp = client.post('/game', data=testdata) assert_response(resp, contains="Central Corridor") testdata = {'userinput': 'tell a joke'} resp = client.post('/game', data=testdata) assert_response(resp, contains="Laser Weapon Armory") testdata = {'userinput': '132'} resp = client.post('/game', data=testdata) assert_response(resp, contains="The Bridge") testdata = {'userinput': 'slowly place the bomb'} resp = client.post('/game', data=testdata) assert_response(resp, contains="Escape Pod") testdata = {'userinput': '2'} resp = client.post('/game', data=testdata) assert_response(resp, contains="You Made it!")
def test_index(): # check that we get a 200 on the / URL resp = app.request("/") assert_response(resp, status="200") # check that we get a 404 on the / URL resp = app.request("/notexists") 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")
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 will die if we choose the wrong direction data = {'action': 'Shoot!'} resp = app.request("/game", method="POST", data=data) assert_response(resp, status="303") resp = app.request("/game") assert_response(resp, contains="You Died!")
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") data = {'name': 'Will', 'greet': 'Howdy'} resp = app.request('/hello', method='POST', data=data) assert_response(resp,contains='Will')
def test_index(): resp=app.request("/") assert_response(resp,status="303 See Other") resp=app.request("/game",method='POST') assert_response(resp,status="303") resp=app.request("/game",method='GET') assert_response(resp,status="200")
def test_index(): # check for the 404 assert_response resp = app.request("/") assert_response(resp, status="404") # test first GET request to /hello resp = app.request("/hello") assert_response(resp) # check default values for the form resp = app.request('/hello', method="POST") assert_response(resp, contains="Nobody") # test that we get expected values data = {'name': "kron", 'greet':'hola'} resp = app.request('/hello', method="POST", data=data) assert_response(resp, contains='kron')
def test_index(): #确认返回了 404 Not Found 相应 resp = app.request("/") print assert_response(resp, status="404") #GET resp = app.request("/hello") assert_response(resp) # assert_response(resp, status="200") #POST resp = app.request("/hello", method="POST") assert_response(resp, contains="Nobody") data = {'name': "Zed", 'greet': 'Hola'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Zed")
def test_index(): # chequea que se obtiene 404 en la URL / resp = app.request("/") assert_response(resp, status="404") # testea nuestra primera peticion GET a /hello resp = app.request("/hello") assert_response(resp) # asegurarse de que los valores por defecto funcionan para el formulario resp = app.request("/hello", method="POST") assert_response(resp, contains="Nadie") # testear que obtenemos los valores esperados data = {'name': 'Jose', 'greet': 'Hola'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Jose")
def test_index(): # We have to check that we get a 404 on the / URL resp = app.request("/") assert_response(resp, status="404") # We have to test our first GET request to /hello resp = app.request("/hello") assert_response(resp) # We also have to make sure default values work for the form resp = app.request("/hello", method="POST") assert_response(resp, contains="Nobody") # We also test that we get expected values data = ['name': 'IniOluwa', 'greet': 'Hey there'] resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="IniOluwa")
def test_index(): # check 404 on the '/' resp = app.request('/') assert_response(resp, status='404') # test GET request to /hello resp = app.request('/hello') assert_response(resp) # make sure default values with for the form resp = app.request('/hello', method="POST") assert_response(resp, contains="Nobody") # test that we get expected value data = {'name': 'Zed', 'greet': 'Hola'} resp = app.request('/hello', method="POST", data=data) assert_response(resp, contains = "Zed")
def test_index(): # Check that we got a 404 in 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 that the 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")
def test_index(): #test get a 404 resp = app.request("/") assert_response(resp, status="404") #test 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")
def test_index(): # check that we get a 404 on the / URL resp = app.request("/") assert_response(resp, status="200") # test our first GET request to /hello resp = app.request("/") 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 room = Room("test_room", "this is the test room") resp = app.request("/game", method="POST", room=room) 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 URL resp = app.request("/hello") assert_response(resp) # make sure default values work from the form resp = app.request("/hello", method="POST") assert_response(resp, contains="Nobody") # t est that we get 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 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 expected values are got data = {'name': 'Nick', 'greet': 'Hello'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="Nick")
def test_index(): # check we get an "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 value works for the from resp = app.request("/hello",method="POST") assert_response(resp,contains=None) # test we get the expected values data = {"name":"Sire","greet":"Hail"} resp = app.request("/hello",method="POST",data=data) assert_response(resp,contains="Sire")
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': 'pani', 'greet': 'Sheretizomen'} resp = app.request("/hello", method="POST", data=data) assert_response(resp, contains="pani")