Пример #1
0
    def test_callback(self):
        from pyramid_rest.resource import Resource, IResourceConfigurator

        context = mock.Mock()

        r = Resource('dad')

        r.callback(context, None, None)

        context.config.with_package.assert_called_once_with(
            r.info.module
            )
        config = context.config.with_package.return_value

        (config
            .registry
            .getUtility
            .assert_called_once_with(IResourceConfigurator)
            )

        (config
            .registry
            .getUtility
            .return_value
            ._add
            .assert_called_once_with(config, r)
            )
Пример #2
0
    def test_callback(self):
        from pyramid_rest.resource import Resource, IResourceConfigurator

        context = mock.Mock()

        r = Resource('dad')

        r.callback(context, None, None)

        context.config.with_package.assert_called_once_with(r.info.module)
        config = context.config.with_package.return_value

        (config.registry.getUtility.assert_called_once_with(
            IResourceConfigurator))

        (config.registry.getUtility.return_value._add.assert_called_once_with(
            config, r))