def go_to_fluffy():
     data0 = {'game': 'Harry Potter Game'}
     resp = app.request('/', method='POST', data=data0)
     session_id = get_session_id(resp)
     header = {'Cookie': session_id}
     app.request('/HPGame', headers=header, method='POST')
     return header
Example #2
0
def test_family_member():
	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")
 def get_past_fluffy(header):
     notes = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
     random.seed(0)
     guess_notes = ''.join(random.sample(notes, 3)) * 3
     data = {'action': guess_notes}
     random.seed(0)
     app.request('/HPGame', headers=header, method='POST', data=data)
Example #4
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("/game")
    assert_response(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 get_past_keys(header):
     random.seed(0)
     h = random.randint(0, 4)
     w = random.randint(0, 4)
     guess_key = str(h) + str(w)
     data = {'action': guess_key}
     random.seed(0)
     app.request('/HPGame', headers=header, method='POST', data=data)
Example #7
0
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)
Example #8
0
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 get_past_chess(header):
     pawns = []
     random.seed(0)
     for i in range(10):
         pawns.append(random.randint(0, 1))
     random.seed(0)
     for pawn in pawns:
         data = {'action': str(pawn)}
         app.request('/HPGame', headers=header, method='POST', data=data)
Example #10
0
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)
Example #11
0
def test__start__end():
    resp=app.request("/game")
    data={"action":"tell a joke"}
    resp=app.request("/game",method="POST",data=data)
    x=((resp.headers['Set-Cookie']).split(";")[0])
    x=x.lstrip('webpy_session_id=')
    y=(open('docs/sessions/%s'%x).read())
    store=web.session.DiskStore('docs/sessions')
    print(store.decode(y))
Example #12
0
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?")
Example #13
0
def test__start__end():
    resp = app.request("/game")
    data = {"action": "tell a joke"}
    resp = app.request("/game", method="POST", data=data)
    x = ((resp.headers['Set-Cookie']).split(";")[0])
    x = x.lstrip('webpy_session_id=')
    y = (open('docs/sessions/%s' % x).read())
    store = web.session.DiskStore('docs/sessions')
    print(store.decode(y))
Example #14
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)
	
Example #15
0
def test_SayHello():
    resp = app.request("/hello")
    assert_response(resp)

    resp = app.request("/hello", method="POST")
    assert_response(resp, contains="Nobody")

    data = {'name': 'Oscar', 'greet': 'Hi'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Oscar")
Example #16
0
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')
Example #17
0
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")
Example #18
0
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")
Example #19
0
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")
Example #20
0
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")
Example #21
0
def test_hello():
    #test GET request for /hello
    resp = app.request("/hello")
    assert_response(resp)
    #making sure default values work for form
    resp = app.request("/hello", method="POST")
    assert_response(resp, contains="Nobody")
    #testing expected values
    data = {'name': 'Zed', 'greet': 'Hola'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Zed")
Example #22
0
def test_hello():
#test GET request for /hello    
    resp=app.request("/hello")
    assert_response(resp)
#making sure default values work for form    
    resp= app.request("/hello", method="POST")
    assert_response(resp, contains="Nobody")
#testing expected values    
    data= {'name':'Zed','greet':'Hola'}
    resp= app.request("/hello",method="POST", data=data)
    assert_response(resp, contains="Zed")
Example #23
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)
Example #24
0
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 /gothon
    resp = app.request("/gothon_game")
    assert_response(resp, status='200')

    # test our first GET request to /zombie
    resp = app.request("/zombie_game")
    assert_response(resp, status='200')
Example #25
0
def test_index():
    # check that we get a 404 on the / URL
    resp = app.request("/")
    assert_response(resp, status="303")

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

    # make sure default values work for the form
    resp = app.request("/start", method="POST")
    assert_response(resp, contains=None, status="303")
Example #26
0
def test_index():
    # check that we get a 404 on the / URL
	resp = app.request("/")
	assert_response(resp, status="303")

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

    # make sure default values work for the form
	resp = app.request("/start", method="POST")
	assert_response(resp, contains=None, status="303")
def test_index():

    resp = app.request("/index")
    assert_response(resp, status="404")
    
    resp = app.request("/game")
    assert_response(resp)

    resp = app.request("/")
    assert_response(resp)
    
    
Example #28
0
def test_index():
    # check that we get a 404 on the / URL
    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': 'Sriram', 'greet': 'Hola'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Sriram")
Example #29
0
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':'liudepeng', 'greet':'Hi' }
	resp = app.request('/hello', method='POST', data=data)
	assert_response(resp, contains='liudepeng')
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")
Example #31
0
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)
Example #32
0
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")
Example #33
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")
Example #34
0
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():
    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")
Example #36
0
def test_index():
    # check that we get a 404 on the / URL
    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': 'Sriram', 'greet': 'Hola'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Sriram")
Example #37
0
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")
Example #38
0
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")
Example #39
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')
Example #40
0
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")
Example #41
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", 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")
Example #42
0
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")
Example #43
0
def test_index():
    # check that we get a 404 on the / URL
    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_game_engine():

    # test our first GET request to /game
    resp = app.request("/game")
    assert_response(resp)    
    
    # make sure default value for action is None
    resp = app.request("/game", method="POST")
    assert_response(resp, contains=None, status="303")

    # test that we get expected values
    data = {"action": "tell a joke"}
    resp = app.request("/game", method="POST", data=data)
    assert_response(resp, contains=None, status="303")
Example #45
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")
  print "resp",resp
  # test that we get expected values
  data = {'name': 'Zed', 'greet': 'Hola'}
  resp = app.request("/hello", method="POST", data=data)
  assert_response(resp, contains="Zed")
Example #46
0
def test_index():
    global cookie
    resp = app.request('/',method = "GET")
    assert_response(resp,status = '200',contains = "Please provide log in information")
    cookie = get_session_id(resp)

    resp = app.request('/',method = "POST",headers = {'Cookie':cookie},data = {'username':'******','password':'******'})
    assert_response(resp,contains = "User does not exist")
    resp = app.request('/',method = "POST",headers = {'Cookie':cookie},data = {'username':'******','password':'******'})
    assert_response(resp,contains = "Wrong password")
    resp = app.request('/',method = "POST",headers = {'Cookie':cookie},data = {'username':'******','password':'******'})
    assert_response(resp,status = '303')
    cookie = get_session_id(resp)

    pass
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 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_hello():
    # test our first GET request to /hello
    resp = app.request("/hello")
    assert_response(resp)

    # test that defaults return correct response
    resp = app.request("/hello", method = "POST")
    print resp
    assert_response(resp, contains = "nobody")

    # test that we get expected values
    data = {'name':'Shirley', 'greet':'vale'}
    resp = app.request("/hello", method = "POST", data = data)
    print resp
    assert_response(resp, contains = "Shirley")
Example #50
0
def test_index():
    #404
    resp = app.request("/lugly")
    assert_response(resp, status="404")
    
    #index
    resp = app.request("/")
    assert_response(resp)
    
    #defaults for form values
#    resp = app.request("/game", method="POST")  #must, must be all uppercase, or tests won't work
#    assert_response(resp, contains="action")
    
    #game
    resp = app.request("/game")
    assert_response(resp)
Example #51
0
def test_GameEngine():
    # test our first GET request to /hello
    resp = app.request("/game")
    #	print resp.data
    assert_response(resp, status="200", contains="You Died")

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

    # test that we get expected values
    #	data = {'name': 'Zed', 'greet': 'Hola'}
    data = {'action': 'go'}
    resp = app.request("/game", method="POST", data=data)
    #	print resp.data
    assert_response(resp, status="303", contains='go')
Example #52
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': 'Elijah', 'greet': 'Poop'}
    resp = app.request("/hello", method="POST", data=data)
    assert_response(resp, contains="Elijah")
Example #53
0
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 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")
Example #55
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("/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")
Example #56
0
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")
Example #57
0
def test_index():
	# Check that we get a 404 on 
	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 we get expected values
	data = {'name': 'Zed', 'greet': 'Hola'}
	resp = app.request("/hello", method="POST", data=data)
	assert_response(resp, contains="Zed")
Example #58
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")
Example #59
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 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")
Example #60
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)
  asset_response(resp, contains='Zed')