Esempio n. 1
0
    def test_given_no_extension_then_callerid_contains_only_user_name(self,
                                                                      assemble_caller_id,
                                                                      line_dao_edit):
        main_user = Mock(User, firstname="firstname")
        line = Mock(Line)
        callerid = assemble_caller_id.return_value = Mock()

        ule_service.update_caller_id(main_user, line)

        assert_that(line.callerid, equal_to(callerid))
        assemble_caller_id.assert_called_once_with(main_user.fullname, None)
        line_dao_edit.assert_called_once_with(line)
Esempio n. 2
0
    def test_given_extension_associated_then_callerid_contains_user_name_and_extension(self,
                                                                                       assemble_caller_id,
                                                                                       line_dao_edit):
        main_user = Mock(User, firstname="firstname")
        line = Mock(Line)
        extension = Mock(Extension, exten="1000")
        callerid = assemble_caller_id.return_value = Mock()

        ule_service.update_caller_id(main_user, line, extension)

        assert_that(line.callerid, equal_to(callerid))
        assemble_caller_id.assert_called_once_with(main_user.fullname, extension.exten)
        line_dao_edit.assert_called_once_with(line)