예제 #1
0
    def test_update_caller_id_only_caller_id_changed(self, user_dao_get):
        user = User(id=1,
                    firstname='firstname',
                    lastname='lastname',
                    caller_id='new_caller_id')

        db_user = User(id=1,
                       firstname='firstname',
                       lastname='lastname',
                       caller_id='"firstname lastname"')

        user_dao_get.return_value = db_user

        user_services.update_caller_id(user)
        user_dao_get.assert_called_once_with(user.id)
        assert_that(user.caller_id, equal_to('"new_caller_id"'))
예제 #2
0
    def test_update_caller_id_firstname_lastname_and_caller_id_changed(self, user_dao_get):
        user = User(id=1,
                    firstname='new_firstname',
                    lastname='new_lastname',
                    caller_id='new_caller_id')

        db_user = User(id=1,
                       firstname='firstname',
                       lastname='lastname',
                       caller_id='"firstname lastname"')

        user_dao_get.return_value = db_user

        user_services.update_caller_id(user)
        user_dao_get.assert_called_once_with(user.id)
        assert_that(user.caller_id, equal_to('"new_caller_id"'))