Ejemplo n.º 1
0
def edit(user):
    validator.validate_edit(user)
    update_caller_id(user)
    user_dao.edit(user)
    update_voicemail_fullname(user)
    line_services.update_callerid(user)
    notifier.edited(user)
Ejemplo n.º 2
0
    def test_update_callerid_with_no_line(self, line_dao_find_by_user_id, line_services_edit):
        expected_caller_id = 'titi'
        user = User(id=1,
                    firstname='titi',
                    caller_id=expected_caller_id)

        line_dao_find_by_user_id.return_value = None

        line_services.update_callerid(user)

        line_dao_find_by_user_id.assert_called_once_with(user.id)
        self.assertEquals(line_services_edit.call_count, 0)
Ejemplo n.º 3
0
    def test_update_callerid_with_no_line(self, line_dao_find_by_user_id, line_services_edit):
        expected_caller_id = 'titi'
        user = User(id=1,
                    firstname='titi',
                    caller_id=expected_caller_id)

        line_dao_find_by_user_id.return_value = None

        line_services.update_callerid(user)

        line_dao_find_by_user_id.assert_called_once_with(user.id)
        self.assertEquals(line_services_edit.call_count, 0)
Ejemplo n.º 4
0
    def test_update_callerid(self, line_dao_find_by_user_id, line_services_edit):
        expected_caller_id = 'titi'
        user = User(id=1,
                    firstname='titi',
                    caller_id=expected_caller_id)
        line = LineSIP(callerid=expected_caller_id,
                       number='1000',
                       name='toto')

        line_dao_find_by_user_id.return_value = line

        line_services.update_callerid(user)

        line_dao_find_by_user_id.assert_called_once_with(user.id)
        line_services_edit.assert_called_once_with(line)
Ejemplo n.º 5
0
    def test_update_callerid(self, line_dao_find_by_user_id, line_services_edit):
        expected_caller_id = 'titi'
        user = User(id=1,
                    firstname='titi',
                    caller_id=expected_caller_id)
        line = LineSIP(callerid=expected_caller_id,
                       number='1000',
                       name='toto')

        line_dao_find_by_user_id.return_value = line

        line_services.update_callerid(user)

        line_dao_find_by_user_id.assert_called_once_with(user.id)
        line_services_edit.assert_called_once_with(line)