def setUp(self): super(TestAPI__user_reset_password, self).setUp() self.create_roles() self.user = User() self.admin_user = User() db.session.add_all((self.user, self.admin_user)) db.session.flush() role_assignment = RoleAssignment( role_id=self.admin_role.id, user_id=self.admin_user.id, ) db.session.add(role_assignment)
def setUp(self): super(TestView__auth_login, self).setUp() self.username = '******' self.password = '******' self.password_md5 = '05a671c66aefea124cc08b76ea6d30bb' self.user = User( id=123, username=self.username, password_md5=self.password_md5, ) db.session.add(self.user)
def setUp(self): super(TestModel__user_search, self).setUp() self.u1, self.u2, self.u3 = [User() for _ in range(3)] self.u1.firstname, self.u1.lastname = 'JohnSr', 'DoeSr' self.u2.email = '*****@*****.**' self.u3.username = '******' self.u1.deleted = False self.u2.deleted = False self.u3.deleted = False db.session.add_all((self.u1, self.u2, self.u3)) db.session.flush()
def setUp(self): super(TestModel__statement_finish_participant, self).setUp() self.create_statements() self.now = int(time.time()) self.duration = 10 self.user = User() db.session.add(self.user) db.session.flush()
def setUp(self): super(TestAPI__statement_set_settings, self).setUp() self.create_roles() self.user = User() self.admin_user = User() self.statement = Statement() db.session.add_all(( self.user, self.admin_user, self.statement, )) db.session.flush() role_assignment = RoleAssignment( user_id=self.admin_user.id, role_id=self.admin_role.id, ) db.session.add(role_assignment)
def setUp(self): super(TestAPI__auth_logout, self).setUp() self.username = '******' self.password = '******' self.password_md5 = '05a671c66aefea124cc08b76ea6d30bb' self.user = User(username=self.username, password=self.password_md5, firstname='some firstname', lastname='some lastname') db.session.add(self.user) db.session.flush()
def setUp(self): super(TestAPI__statement_start_virtual, self).setUp() self.virtual_statement = Statement( virtual_olympiad=1, virtual_duration=300, time_start=0, time_stop=int(time.time()) + 100, ) db.session.add(self.virtual_statement) self.user = User() db.session.add(self.user) db.session.flush()
def setUp(self): super(TestAPI__statement_start, self).setUp() self.user = User() db.session.add(self.user) self.now = time.time() self.duration = 290 self.statement = Statement( olympiad=1, time_start=self.now - 10, time_stop=self.now + self.duration, ) db.session.add(self.statement) db.session.flush()
def setUp(self): super(TestModel__Statement_finish_virtual, self).setUp() self.now = int(time.time()) self.virtual_duration = 100 self.time_start = self.now - 60 self.statement = Statement( virtual_olympiad=1, virtual_duration=self.virtual_duration, time_start=self.time_start, ) db.session.add(self.statement) self.user = User() db.session.add(self.user) db.session.flush()
def setUp(self): super(TestModel__statement_start, self).setUp() self.now = int(time.time()) self.time_start = self.now - 60 self.time_stop = self.now + 30 self.statement = Statement( olympiad=1, time_start=self.time_start, time_stop=self.time_stop, ) db.session.add(self.statement) self.user = User() db.session.add(self.user) db.session.flush()
def setUp(self): super(TestView__user_reset_password, self).setUp() self.create_users() self.create_roles() role_assignment = RoleAssignment( role=self.admin_role, user_id=self.users[0].id, ) db.session.add(role_assignment) db.session.flush() self.password_md5 = 'some md5' self.user = User(password_md5=self.password_md5) db.session.add(self.user) db.session.flush()
def setUp(self): super(TestModel__statement_start_participant, self).setUp() self.create_statements() self.now = int(time.time()) self.duration = 10 self.user = User() db.session.add(self.user) self.time_start = self.now self.time_stop = self.now + 100 self.statement = Statement( time_start=self.time_start, time_stop=self.time_stop, ) db.session.add(self.statement) db.session.flush()
def setUp(self): super(TestAPI__statement_finish_virtual, self).setUp() self.virtual_statement = Statement( virtual_olympiad=1, virtual_duration=300, ) db.session.add(self.virtual_statement) self.user = User() db.session.add(self.user) db.session.flush() self.actual_duration = 10 self.participant = Participant( user_id=self.user.id, statement_id=self.virtual_statement.id, start=time.time() - self.actual_duration, duration=300, ) db.session.add(self.participant)
def setUp(self): super(TestAPI__statement_finish, self).setUp() self.user = User() db.session.add(self.user) self.now = time.time() self.duration = 290 self.statement = Statement( olympiad=1, time_start=self.now - 10, time_stop=self.now + self.duration, ) db.session.add(self.statement) db.session.flush() self.actual_duration = 5 self.participant = Participant( user_id=self.user.id, statement_id=self.statement.id, start=int(self.now - self.actual_duration), duration=self.duration, ) db.session.add(self.participant)
def setUp(self): super(TestModel__statement_serialize, self).setUp() self.course = Course(id=123) db.session.add(self.course) self.statement = Statement(course=self.course) self.user = User() db.session.add_all([self.statement, self.user]) db.session.flush() self.course_module = CourseModule( instance_id=self.statement.id, module=19, course_id=self.course.id, ) self.participant = Participant( user_id=self.user.id, statement_id=self.statement.id, ) db.session.add_all([self.course_module, self.participant])
def test_deleted(self): self.u1.deleted = True assert_that(User.search_by_string('John').count(), equal_to(1)) assert_that(User.search_by_string('Doe').count(), equal_to(1))
def test_substring(self): assert_that(User.search_by_string('doe').count(), equal_to(2))
def test_firstname_and_lastname_reversed(self): assert_that(User.search_by_string('doesr johnsr').count(), equal_to(1))
def test_lastname(self): assert_that(User.search_by_string('doesr').count(), equal_to(1))
def test_firstname(self): assert_that(User.search_by_string('johnsr').count(), equal_to(1))
def test_username(self): assert_that(User.search_by_string('edoed').count(), equal_to(1))
def test_email(self): assert_that(User.search_by_string('john@john').count(), equal_to(1))
def setUp(self): super(TestView__auth_logout, self).setUp() self.user = User() db.session.add(self.user) db.session.flush()