Ejemplo n.º 1
0
    def test_document_proxy_proxies_call_to_field_names(self):
        document = Mock()

        proxy = DocumentProxy(Mock(), document)

        result = proxy.field_names()

        assert_that(result, equal_to(document.field_names.return_value))
        document.field_names.assert_called_once_with()
Ejemplo n.º 2
0
    def test_document_proxy_proxies_call_to_validate(self):
        document = Mock()
        content = Mock()
        action = Mock()

        proxy = DocumentProxy(Mock(), document)

        proxy.validate(content, action)

        document.validate.assert_called_once_with(content, action)
Ejemplo n.º 3
0
    def test_given_a_parser_and_document_when_request_parsed_then_parser_called(self):
        parser = Mock()
        document = Mock()
        request = Mock()

        content = parser.parse.return_value

        proxy = DocumentProxy(parser, document)
        result = proxy.parse(request, 'action')

        assert_that(result, equal_to(content))
        parser.parse.assert_called_once_with(request, document, 'action')