예제 #1
0
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
예제 #2
0
    def test_associate_main_user(self):
        ule_row = self.add_user_line_without_exten()
        extension_row = self.add_extension()

        line_extension = LineExtension(line_id=ule_row.line_id,
                                       extension_id=extension_row.id)

        result = dao.associate(line_extension)

        self.assert_line_extension_has_ids(result, ule_row.line_id, ule_row.extension_id)
        self.assert_extension_is_associated(ule_row.line_id, extension_row.id)
예제 #3
0
    def test_associate_no_user(self):
        line_row = self.add_line()
        extension_row = self.add_extension()

        line_extension = LineExtension(line_id=line_row.id,
                                       extension_id=extension_row.id)

        result = dao.associate(line_extension)

        self.assert_line_extension_has_ids(result, line_row.id, extension_row.id)
        self.assert_extension_is_associated(line_row.id, extension_row.id)
예제 #4
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_associate_main_user(self):
        ule_row = self.add_user_line_without_exten()
        extension_row = self.add_extension()

        line_extension = LineExtension(line_id=ule_row.line_id,
                                       extension_id=extension_row.id)

        result = dao.associate(line_extension)

        self.assert_line_extension_has_ids(result, ule_row.line_id,
                                           ule_row.extension_id)
        self.assert_extension_is_associated(ule_row.line_id, extension_row.id)
예제 #5
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_associate_no_user(self):
        line_row = self.add_line()
        extension_row = self.add_extension()

        line_extension = LineExtension(line_id=line_row.id,
                                       extension_id=extension_row.id)

        result = dao.associate(line_extension)

        self.assert_line_extension_has_ids(result, line_row.id,
                                           extension_row.id)
        self.assert_extension_is_associated(line_row.id, extension_row.id)
예제 #6
0
    def test_associate_main_and_secondary_user(self):
        main_ule = self.add_user_line_without_exten()
        secondary_user = self.add_user()
        secondary_ule = self.associate_secondary_user(main_ule, secondary_user)
        extension_row = self.add_extension()

        line_extension = LineExtension(line_id=main_ule.line_id,
                                       extension_id=extension_row.id)

        result = dao.associate(line_extension)

        self.assert_line_extension_has_ids(result, main_ule.line_id, extension_row.id)
        self.assert_extension_is_associated(main_ule.line_id, extension_row.id)
        self.assert_extension_is_associated(secondary_ule.line_id, extension_row.id)
예제 #7
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_associate_main_and_secondary_user(self):
        main_ule = self.add_user_line_without_exten()
        secondary_user = self.add_user()
        secondary_ule = self.associate_secondary_user(main_ule, secondary_user)
        extension_row = self.add_extension()

        line_extension = LineExtension(line_id=main_ule.line_id,
                                       extension_id=extension_row.id)

        result = dao.associate(line_extension)

        self.assert_line_extension_has_ids(result, main_ule.line_id,
                                           extension_row.id)
        self.assert_extension_is_associated(main_ule.line_id, extension_row.id)
        self.assert_extension_is_associated(secondary_ule.line_id,
                                            extension_row.id)
예제 #8
0
파일: services.py 프로젝트: jaunis/xivo-dao
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