Пример #1
0
def __clear_app_data():
    """
	清空应用数据
	"""
    sql = """
	
	"""
    SQLService.use().execute_sql(sql)
Пример #2
0
def __clear_app_data():
	"""
	清空应用数据
	"""
	sql = """
		delete from space_space;
		delete from space_member;
	"""
	SQLService.use().execute_sql(sql)
Пример #3
0
def init_bdd_users():
    """
	初始化预置user
	"""
    sql = """
		delete from auth_user;
	"""
    SQLService.use().execute_sql(sql)
    for name, phone in USERS.items():
        data = {
            "phone": phone,
            "password": settings.BDD_USER_PWD,
        }
        resp = remote_client.put('user.registered_user', data)
        bdd_util.assert_api_call_success(resp)
Пример #4
0
def get_space_id(space_name, username=None):
    sql = u"""
		select id from space_space where name='{}' 
	""".format(space_name)
    if username is not None:
        user_id = user_util.get_user_id(username)
        sql += " and user_id={} ".format(user_id)
    record = SQLService.use().execute_sql(sql).fetchone()
    return record[0]
Пример #5
0
def get_user_id(username):
    phone = USERNAME2PHONE[username]
    if phone is None:
        raise Exception("invalid username: "******"""
		select id from auth_user where phone='{}';
	""".format(phone)
    record = SQLService.use().execute_sql(sql).fetchone()
    return record[0]
Пример #6
0
def step_impl(context, username, space_name):
    expected = json.loads(context.text)
    response = context.client.get(
        'space.members', {"space_id": get_space_id(space_name, username)})
    actual = response['data']['members']
    for member in actual:
        if member['nick_name'] == '':
            sql = """
				select phone from auth_user where id={}
			""".format(member['user_id'])
            record = SQLService.use().execute_sql(sql).fetchone()
            for nick_name, phone in user_util.USERNAME2PHONE.items():
                if phone == record[0]:
                    member['nick_name'] = nick_name
                    break
    bdd_util.assert_json(expected, actual)
Пример #7
0
def update_space_code(space_id, code):
    sql = """
		update space_space set code='{}' 
		where id={};
	""".format(code, space_id)
    SQLService.use().execute_sql(sql)