Beispiel #1
0
def add(phone,owner,user):
	device = {
		'phone':phone,
		'active_code':StringUtil.active_code_generator(),
		'active':False,
		'owner':owner,
		'time':time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())),
		'pull_info':[]
	}
	user['devices'].append(device)
	UserCollection.update({'tid':user['tid']},user)
	return RESPONSE.SUCCESS
Beispiel #2
0
	user2 = UserDao.get_user_by_tid(user['tid'])
	assert user2['email'] == email

def test_get_user_by_token():
	user = UserDao.get_user_by_email(email)
	user2 = UserDao.get_user_by_token(user['token'])
	assert user2['email'] == email


##################UserDao Done##########################



##################DeviceDao##########################

uid = StringUtil.active_code_generator()
owner = 'zxl'
did = '1234'
cid = '12345'
imei = '123456'

def test_add():
	user = UserDao.get_user_by_email(email)
	result = DeviceDao.add(uid,owner,user)
	assert result == 'success'

def test_exist():
	user = UserDao.get_user_by_email(email)
	device = DeviceDao.exist(uid,owner,user)
	assert device == True