def setUp(self): # if you visit in wechat, will do the following things user_len = len(test_user_openid) for i in range(user_len): User(open_id=test_user_openid[i], student_id=test_student_id[i]).save() self.c = Client() published_activity.save() published_activity2.save() self.get_key_text = [ XML_TEXT_BASE % (test_user_openid[i], '抢票 key') for i in range(user_len) ] self.get_key_text2 = [ XML_TEXT_BASE % (test_user_openid[i], '抢票 key2') for i in range(user_len) ] self.refund_key_text = [ XML_TEXT_BASE % (test_user_openid[i], '退票 key') for i in range(user_len) ] self.show_key_text = [ XML_TEXT_BASE % (test_user_openid[i], '取票 key') for i in range(user_len) ]
def setUp(self): for i in range(6): u = User(open_id=str(i), student_id=str(i)) u.save() a = Activity(name=str(1), key='11', description='aaa', start_time=timezone.now(), end_time=timezone.now(), place='ss', book_end=timezone.now(), book_start=timezone.now(), total_tickets='123', status=Activity.STATUS_PUBLISHED, pic_url='sss', remain_tickets='1') a.save()
def createUser(openID, studentID): user = User(open_id=openID, student_id=studentID) user.save() return user