Пример #1
0
    def it_can_construct_different_uris_for_different_http_verbs(self):
        class Doc(Document):
            id = fields.NumberField()

            class Meta:
                backend_type = 'http'

            def post_uri(self):
                return 'post'

            def get_uri(self):
                return 'get'

            def uri(self):
                return 'uri'

        manager = BackendManager('http')
        doc = Doc({'id': 1})

        # First make sure we can retrieve the specific uri's for this http verb
        eq_('post', manager._get_uri('post', doc))
        eq_('get', manager._get_uri('get', doc))

        # And now return the generic uri for a non specified verb
        eq_('uri', manager._get_uri('put', doc))