def test_find_main_user_line_no_line(self): self.add_user() line_id = 2 result = user_line_dao.find_main_user_line(line_id) assert_that(result, equal_to(None))
def test_find_main_user_line(self): user = self.add_user() line1 = self.add_line() line2 = self.add_line() main_user_line = self.add_user_line(user_id=user.id, line_id=line1.id, main_user=True, main_line=True) self.add_user_line(user_id=user.id, line_id=line2.id, main_user=False, main_line=True) result = user_line_dao.find_main_user_line(line1.id) assert_that(result, instance_of(UserLine)) assert_that(result, has_property('user_id', main_user_line.user_id), has_property('line_id', main_user_line.line_id) )
def _adjust_optional_parameters(user_line): user_line_main_user = dao.find_main_user_line(user_line.line_id) if user_line_main_user is not None: user_line.main_user = (user_line.user_id == user_line_main_user.user_id)
def associate_line_extension(line_extension): created_line_extension = line_extension_dao.associate(line_extension) main_user_line = user_line_dao.find_main_user_line(created_line_extension.line_id) if main_user_line: fix_associations(main_user_line) return created_line_extension
def associate_user_line(user_line): created_user_line = user_line_dao.associate(user_line) main_user_line = user_line_dao.find_main_user_line(created_user_line.line_id) fix_associations(main_user_line) return created_user_line
def test_find_main_user_line_one_line_no_user(self): user_line = self.add_user_line_without_user() result = user_line_dao.find_main_user_line(user_line.line_id) assert_that(result, none())
def test_find_main_user_line_one_user(self): user_line = self.add_user_line_without_exten() result = user_line_dao.find_main_user_line(user_line.line_id) assert_that(result.user_id, equal_to(user_line.user_id))
def test_find_main_user_line_no_user(self): line_id = 33 result = user_line_dao.find_main_user_line(line_id) assert_that(result, equal_to(None))