本文整理汇总了Python中test_helpers.server_get函数的典型用法代码示例。如果您正苦于以下问题:Python server_get函数的具体用法?Python server_get怎么用?Python server_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了server_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_college_403_bad_creds
def test_college_403_bad_creds():
params = {"username":"student_coll1_1",
"password":"thisiswrong"}
r, data = test_helpers.server_get("/colleges/college-1", params)
assert r.status == 403
示例2: test_colleges_blueshirt
def test_colleges_blueshirt():
params = {"username": "blueshirt", "password": "blueshirt"}
r, data = test_helpers.server_get("/colleges", params)
print r.status
print data
assert r.status == 200
assert len(json.loads(data)["colleges"]) == 2
示例3: test_user_get_valid_teacher_body
def test_user_get_valid_teacher_body(self):
resp = helpers.server_get("/user/student_coll1_1", {"token":self.auth_hash})
body = resp.read()
print body
hash = json.loads(body)
self.assertEqual(hash["full_name"], "student1 student")
self.assertEqual(hash["email"], "[email protected]")
示例4: test_user_get_wrong_user
def test_user_get_wrong_user():
params = {"username":"teacher_coll2",
"password":"noway",
}
r,data = test_helpers.server_get("/user/student_coll1_1", params)
assert r.status == 403
示例5: test_activate_wrong_code
def test_activate_wrong_code():
pu = create_pending_user()
pu.save()
r,data = test_helpers.server_get("/activate/abc/bees")
status = r.status
assert status == 403, data
示例6: test_colleges_no_user
def test_colleges_no_user():
params = {}
r, data = test_helpers.server_get("/colleges", params)
print r, data
assert r.status == 403
示例7: test_user_get_blueshirt_wrong_password
def test_user_get_blueshirt_wrong_password():
params = {"username":"blueshirt",
"password":"a",
}
r,data = test_helpers.server_get("/user/blueshirt", params)
assert r.status == 403
示例8: test_user_get_other_can_view
def test_user_get_other_can_view():
params = {"username":"blueshirt",
"password":"blueshirt",
}
r,data = test_helpers.server_get("/user/student_coll1_1", params)
assert r.status == 200
assert data.find("student_coll1_1") != -1
示例9: test_college_blueshirt_can_see_any_college
def test_college_blueshirt_can_see_any_college():
params = {"username":"blueshirt",
"password":"blueshirt"}
r, data = test_helpers.server_get("/colleges/college-2", params)
assert r.status == 200
resp = json.loads(data)
assert "users" not in resp.keys()
示例10: test_user_teams
def test_user_teams():
params = {"username":"student_coll1_1",
"password":"cows",
}
r,data = test_helpers.server_get("/user/student_coll1_1", params)
data = json.loads(data)
assert r.status == 200
assert ["team-ABC"] == data[u"teams"]
示例11: test_user_colleges
def test_user_colleges():
params = {"username":"blueshirt",
"password":"blueshirt",
}
r,data = test_helpers.server_get("/user/blueshirt", params)
data = json.loads(data)
assert r.status == 200
assert "college-1" in data[u"colleges"]
示例12: test_user_withdrawn_false
def test_user_withdrawn_false():
params = {"username":"teacher_coll2",
"password":"noway",
}
r,data = test_helpers.server_get("/user/teacher_coll2", params)
data = json.loads(data)
assert r.status == 200
assert not data['has_withdrawn']
示例13: test_user_post_set_email_email
def test_user_post_set_email_email(self):
args_hash = {}
args_hash["token"] = self.auth_hash
args_hash["email"] = "[email protected]" + str(random.randint(0,10000)) + ".com"
resp = helpers.server_post("/user/student_coll2_2", args_hash)
self.assertEqual(resp.status, 200)
resp = helpers.server_get("/user/student_coll2_2", {"token":self.auth_hash})
body = json.loads(resp.read())
self.assertEqual(body["email"], args_hash["email"])
示例14: test_user_get_self_wrong_case
def test_user_get_self_wrong_case():
"""
Tests that when a user auths with the wrong case,
and requests the wrong case of username in the url,
we still respond with the correctly cased data.
"""
params = {"username":"Student_Coll1_1",
"password":"cows"}
r,data = test_helpers.server_get("/user/studenT_coll1_1", params)
assert r.status == 200
assert data.find("student_coll1_1") != -1
示例15: test_get_college_body
def test_get_college_body(self):
resp = helpers.server_get("/college", {"token":self.auth_hash})
obj = json.loads(resp.read())
self.assertTrue(obj.has_key("userids"))
self.assertTrue("teacher_coll1" in obj["userids"])
self.assertTrue("student_coll1_1" in obj["userids"])
self.assertTrue("student_coll1_2" in obj["userids"])
self.assertEqual(obj["college_name"], "college the first")
self.assertTrue("team-ABC" in obj["teams"])
self.assertTrue("team-DFE" in obj["teams"])