示例#1
0
    def test_upload_pic(self, monkeypatch):
        account = DummyAccount()
        account.protocol = DummyProtocol()

        temp = DummyResponse('ble')
        fields = {'media': 'ble'}
        files = {'path': '/tmp/dummy'}
        custom_headers = {'Agent': 'DummyAgent'}
        monkeypatch.setattr(requests, 'post', lambda w, files, data, headers: temp)

        upload_service = UploadService('example.com', 'example.com/v1')
        response = upload_service._upload_pic(account, fields, files, custom_headers)
        assert response == 'ble'
示例#2
0
    def test_upload_pic(self, monkeypatch):
        account = DummyAccount()
        account.protocol = DummyProtocol()

        temp = DummyResponse('ble')
        fields = {'media': 'ble'}
        files = {'path': '/tmp/dummy'}
        custom_headers = {'Agent': 'DummyAgent'}
        monkeypatch.setattr(requests, 'post',
                            lambda w, files, data, headers: temp)

        upload_service = UploadService('example.com', 'example.com/v1')
        response = upload_service._upload_pic(account, fields, files,
                                              custom_headers)
        assert response == 'ble'
示例#3
0
文件: yfrog.py 项目: pnael/Python
 def __init__(self):
     UploadService.__init__(self, "yfrog.com", "/api/xauth_upload")
示例#4
0
 def __init__(self):
     UploadService.__init__(self, "twitgoo.com", "/api/upload")
示例#5
0
 def __init__(self):
     UploadService.__init__(self, "api.mobypicture.com", "/2.0/upload.xml")
示例#6
0
 def __init__(self):
     UploadService.__init__(self, "twitgoo.com", "/api/upload")
示例#7
0
 def __init__(self):
     UploadService.__init__(self, "api.twitpic.com", "/2/upload.xml")
示例#8
0
 def __init__(self):
     UploadService.__init__(self, "img.ly", "/api/2/upload.xml")
示例#9
0
 def __init__(self):
     UploadService.__init__(self, "yfrog.com", "/api/xauth_upload")
示例#10
0
 def __init__(self):
     UploadService.__init__(self, "api.twitpic.com", "/2/upload.xml")