本文整理汇总了Python中test_helpers.server_get函数的典型用法代码示例。如果您正苦于以下问题:Python server_get函数的具体用法?Python server_get怎么用?Python server_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了server_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:Krenair,项目名称:nemesis,代码行数:7,代码来源:test_colleges_individual.py
示例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
开发者ID:samphippen,项目名称:nemesis,代码行数:7,代码来源:test_colleges.py
示例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]")
开发者ID:jmorse,项目名称:nemesis,代码行数:7,代码来源:test_user_get.py
示例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
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:7,代码来源:test_user_get.py
示例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
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:7,代码来源:test_activations.py
示例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
开发者ID:samphippen,项目名称:nemesis,代码行数:7,代码来源:test_colleges.py
示例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
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:8,代码来源:test_user_get.py
示例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
开发者ID:Krenair,项目名称:nemesis,代码行数:8,代码来源:test_user_get.py
示例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()
开发者ID:Krenair,项目名称:nemesis,代码行数:9,代码来源:test_colleges_individual.py
示例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"]
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:10,代码来源:test_user_get.py
示例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"]
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:10,代码来源:test_user_get.py
示例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']
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:10,代码来源:test_user_get.py
示例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"])
开发者ID:jmorse,项目名称:nemesis,代码行数:10,代码来源:test_user_post.py
示例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
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:11,代码来源:test_user_get.py
示例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"])
开发者ID:jmorse,项目名称:nemesis,代码行数:11,代码来源:test_college.py
示例16: test_user_properties_student
def test_user_properties_student():
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 data['is_student']
assert not data['is_team_leader']
assert not data['is_blueshirt']
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:12,代码来源:test_user_get.py
示例17: test_verify_outdated_request
def test_verify_outdated_request(self):
with sqlite_connect() as conn:
cur = conn.cursor()
statement = "INSERT INTO password_resets (username, requestor_username, request_time, verify_code) VALUES (?,?,?, ?)"
days = config.getint('nemesis', 'password_reset_days')
old = datetime.datetime.now() - datetime.timedelta(days = days + 2)
arguments = ('abc', 'blueshirt', old.strftime('%Y-%m-%d %H:%M:%S'), 'bees')
cur.execute(statement, arguments)
conn.commit()
r, data = test_helpers.server_get("/reset_password/abc/bees")
self.assertEqual(410, r.status, data)
开发者ID:PeterJCLaw,项目名称:nemesis,代码行数:12,代码来源:test_send_password_reset.py
示例18: test_verify_outdated_request
def test_verify_outdated_request():
conn = test_helpers.sqlite_connect()
cur = conn.cursor()
statement = "INSERT INTO email_changes (username, new_email, request_time, verify_code) VALUES (?,?,?, ?)"
old = datetime.datetime.now() - datetime.timedelta(days = 4)
arguments = ('abc', '[email protected]', old.strftime('%Y-%m-%d %H:%M:%S'), 'bees')
cur.execute(statement, arguments)
conn.commit()
r,data = test_helpers.server_get("/verify/abc/bees")
status = r.status
assert status == 410, data
开发者ID:Krenair,项目名称:nemesis,代码行数:12,代码来源:test_email_verification.py
示例19: test_college_teacher_cant_see_blueshirt
def test_college_teacher_cant_see_blueshirt():
params = {"username":"teacher_coll1",
"password":"facebees"}
r, data = test_helpers.server_get("/colleges/college-1", params)
assert r.status == 200
resp = json.loads(data)
assert resp["name"] == "college the first"
assert "blueshirt" not in set(resp["users"])
开发者ID:Krenair,项目名称:nemesis,代码行数:12,代码来源:test_colleges_individual.py
示例20: test_college_teacher_can_see_students_and_self
def test_college_teacher_can_see_students_and_self():
params = {"username":"teacher_coll1",
"password":"facebees"}
r, data = test_helpers.server_get("/colleges/college-1", params)
assert r.status == 200
resp = json.loads(data)
assert resp["name"] == "college the first"
assert "teacher_coll1" in set(resp["users"])
assert "student_coll1_1" in set(resp["users"])
assert "student_coll1_2" in set(resp["users"])
开发者ID:Krenair,项目名称:nemesis,代码行数:13,代码来源:test_colleges_individual.py
注:本文中的test_helpers.server_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论