示例#1
0
class WhenMakingRequests:
    def setup(self):
        self.web_client = Dingus()
        self.web_client.request.return_value = ['application/fake', '']
        self.link = Link('/', self.web_client)

    def should_forward_get_requests_to_web_client(self):
        self.link.get()
        assert self.web_client.calls('request',
                                     'GET',
                                     '/',
                                     False,
                                     None).one()

    def should_forward_put_requests_to_web_client(self):
        self.link.put('putdata')
        assert self.web_client.calls('request',
                                     'PUT',
                                     '/',
                                     False,
                                     'putdata').one()

    def should_forward_post_requests_to_web_client(self):
        self.link.post('postdata')
        assert self.web_client.calls('request',
                                     'POST',
                                     '/',
                                     False,
                                     'postdata').one()

    def should_forward_delete_requests_to_web_client(self):
        self.link.delete()
        assert self.web_client.calls('request',
                                     'DELETE',
                                     '/',
                                     False,
                                     None).one()
示例#2
0
class WhenMakingRequests:
    def setup(self):
        self.web_client = Dingus()
        self.web_client.request.return_value = ['application/fake', '']
        self.link = Link('/', self.web_client)

    def should_forward_get_requests_to_web_client(self):
        self.link.get()
        assert self.web_client.calls('request', 'GET', '/', False, None).one()

    def should_forward_put_requests_to_web_client(self):
        self.link.put('putdata')
        assert self.web_client.calls('request', 'PUT', '/', False,
                                     'putdata').one()

    def should_forward_post_requests_to_web_client(self):
        self.link.post('postdata')
        assert self.web_client.calls('request', 'POST', '/', False,
                                     'postdata').one()

    def should_forward_delete_requests_to_web_client(self):
        self.link.delete()
        assert self.web_client.calls('request', 'DELETE', '/', False,
                                     None).one()
示例#3
0
 def setup(self):
     self.web_client = Dingus()
     self.web_client.request.return_value = ['application/fake', '']
     link = Link('/foo/%s/bar', self.web_client)
     link.get('variable')
示例#4
0
 def setup(self):
     self.web_client = Dingus()
     self.web_client.request.return_value = ['application/fake', '']
     link = Link('/foo/%s/bar', self.web_client)
     link.get('variable')