예제 #1
0
    def test_associate_with_sip_line_when_voicemail_disabled(self):
        extension = '1000'
        user_id, line_id, protocol_id = self.prepare_user_and_line(extension, 'sip')
        voicemail_id = self.prepare_voicemail(extension)

        user_voicemail = UserVoicemail(user_id=user_id, voicemail_id=voicemail_id, enabled=False)
        user_voicemail_dao.associate(user_voicemail)

        self.assert_user_was_associated_with_voicemail(user_id, voicemail_id, enabled=False)
        self.assert_sip_line_was_associated_with_voicemail(protocol_id, voicemail_id)
예제 #2
0
    def test_associate_with_sip_line_when_voicemail_disabled(self):
        extension = '1000'
        user_id, line_id, protocol_id = self.prepare_user_and_line(extension, 'sip')
        voicemail_id = self.prepare_voicemail(extension)

        user_voicemail = UserVoicemail(user_id=user_id, voicemail_id=voicemail_id, enabled=False)
        user_voicemail_dao.associate(user_voicemail)

        self.assert_user_was_associated_with_voicemail(user_id, voicemail_id, enabled=False)
        self.assert_sip_line_was_associated_with_voicemail(protocol_id, voicemail_id)
예제 #3
0
    def test_associate_with_sip_line_when_secondary_user(self):
        extension = '1000'
        main_user_id, secondary_user_id, line_id, protocol_id = self.prepare_main_and_secondary_user(extension, 'sip')
        voicemail_id = self.prepare_voicemail(extension)

        user_voicemail = UserVoicemail(user_id=secondary_user_id, voicemail_id=voicemail_id)
        user_voicemail_dao.associate(user_voicemail)

        self.assert_user_was_associated_with_voicemail(secondary_user_id, voicemail_id, enabled=True)
        self.assert_sip_line_was_not_associated_with_voicemail(protocol_id, voicemail_id)
예제 #4
0
    def test_associate_with_sip_line_when_secondary_user(self):
        extension = '1000'
        main_user_id, secondary_user_id, line_id, protocol_id = self.prepare_main_and_secondary_user(extension, 'sip')
        voicemail_id = self.prepare_voicemail(extension)

        user_voicemail = UserVoicemail(user_id=secondary_user_id, voicemail_id=voicemail_id)
        user_voicemail_dao.associate(user_voicemail)

        self.assert_user_was_associated_with_voicemail(secondary_user_id, voicemail_id, enabled=True)
        self.assert_sip_line_was_not_associated_with_voicemail(protocol_id, voicemail_id)
예제 #5
0
파일: services.py 프로젝트: jaunis/xivo-dao
def associate(user_voicemail):
    validator.validate_association(user_voicemail)
    dao.associate(user_voicemail)
    notifier.associated(user_voicemail)
    return user_voicemail