Exemplo n.º 1
0
    def reset_db(self):
        # 初始化数据库
        db = MongoProcess(self.db_name, host=CONST.MONGO_HOST)
        db.init()

        # 清空服务端缓存
        cache = Cache(self.baseUrl)
        cache.clean()
Exemplo n.º 2
0
    def run(self):
        # 将过期时间设置为1分钟
        db = MongoProcess("uiac", host=CONST.MONGO_HOST)
        db.set_expire_time("1")

        self.recycle()
        self.test()

        db.set_expire_time("20")
        self.recycle()
Exemplo n.º 3
0
        #     Logger.error("enable user, expected code is 10000002")
        #     Logger.error(str(response.json()))
        # app_id不合法
        response = u_status.enable_user(uid_1, uid_2, token_1, app_id_err)
        if response.json()["code"] != "10000003":
            Logger.error("enable user, expected code is 10000003")
            Logger.error(str(response.json()))
        # 解禁成功
        response = u_status.enable_user(uid_1, uid_2, token_1, app_id_1)
        if str(response.json()["result"]) != "True":
            Logger.error("enable user, expected result is \"True\"")
            Logger.error(str(response.json()))
        # 解禁成功后,能正常登陆
        response = a_auth.login(user_code_2, password, app_id_1)
        if response.json()["uid"] != uid_2:
            Logger.error("enable user, fail to login")
            Logger.error(str(response.json()))


if __name__ == "__main__":
    db = MongoProcess("uiac", "127.0.0.1", 27017)
    db.clear()
    db.init()

    cache = Cache("http://127.0.0.1:8081")
    cache.clean()

    Logger.init()
    admin = AccountAdmin(CONST.SERVICE_URL)
    admin.run()
Exemplo n.º 4
0
		if len(rtn) != 1:
			Logger.error("query user token failed!expect=%s, actual=%s", 1, len(rtn))
			return

		rtn = self.logout(login_user2["uid"], app2_token)
		if rtn is None:
			Logger.error("logout failed!user=%s", login_user2)
			return

	def run(self):
		self.recycle()
		self.test_single()
		self.recycle()

		self.test_single_mul_app()
		self.recycle()

if __name__ == "__main__":
	db = MongoProcess("uiac", CONST.MONGO_HOST)
	#db.init()
	Logger.init()
	test = SingleUserTest(CONST.SERVICE_URL)
	test.run()

	if Logger.is_failed():
		print("Test failed!")
	else:
		print("Test success!")

Exemplo n.º 5
0
        self.http_svc2 = None

    def run(self):
        appid1 = "1"
        appid2 = "2"

        self.test()
        self.recycle()

        # 删除监听
        self.push_obj.un_register(appid1)
        self.push_obj.un_register(appid2)

        if self.http_svc1 is not None:
            self.http_svc1.stop()

        if self.http_svc2 is not None:
            self.http_svc2.stop()


if __name__ == "__main__":
    db = MongoProcess("uiac", CONST.MONGO_HOST)
    db.init()
    Logger.init()
    test = PushObserverTest(CONST.SERVICE_URL)
    test.run()

    if Logger.is_failed():
        print("Test failed!")
    else:
        print("Test success!")