Пример #1
0
 def setUp(self):
     logging.basicConfig()
     logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
     self.mock_handler = MockLoggingHandler()
     LOGGER.addHandler(self.mock_handler)
     self.temp_file = tempfile.NamedTemporaryFile()
     with open(self.temp_file.name, 'w') as f:
         f.write("123456")
Пример #2
0
    def setUp(self):
        self.key = "dummy_key"
        self.server = "dummy_server"
        self.client = WTApiClient(**{"key": self.key, "server": self.server})

        logging.basicConfig()
        logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
        self.mock_handler = MockLoggingHandler()
        LOGGER.addHandler(self.mock_handler)
Пример #3
0
 def setUp(self):
     self.kwargs = {
         "key": "test_key",
         "token": "test_token",
         "server": "test_server",
     }
     logging.basicConfig()
     logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
     self.mock_handler = MockLoggingHandler()
     LOGGER.addHandler(self.mock_handler)
Пример #4
0
 def setUp(self):
     self.kwargs = {
         "client_options": {
             "key": "test_key",
             "token": "test_token",
             "server": "test_server",
         },
         "id": 1,
         "part_number": 1,
         "multipart_upload_id": 1
     }
     logging.basicConfig()
     logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
     self.mock_handler = MockLoggingHandler()
     LOGGER.addHandler(self.mock_handler)
Пример #5
0
 def setUp(self):
     logging.basicConfig()
     logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
     self.mock_handler = MockLoggingHandler()
     LOGGER.addHandler(self.mock_handler)
     finish_response = FakeResponse(ok=True)
     self.mock_get_upload_url = mock.patch(
         "wetransfer.api_requests.GetUploadURL.create").start()
     self.mock_upload_part = mock.patch(
         "wetransfer.api_requests.UploadPart.create").start()
     self.temp_file = tempfile.NamedTemporaryFile()
     with open(self.temp_file.name, 'w') as f:
         f.write("123456")
     self.item = File(self.temp_file.name)
     self.item.client_options = {}
     self.item.id = 1
Пример #6
0
 def setUp(self):
     self.kwargs = {
         "key": "test_key",
         "token": "test_token",
         "server": "test_server",
     }
     logging.basicConfig()
     logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
     self.mock_handler = MockLoggingHandler()
     LOGGER.addHandler(self.mock_handler)
     self.expected_agent = "WT python SDK v{0}".format(__version__)
     self.expected_headers = {
         "User-Agent": self.expected_agent,
         "Content-Type": "application/json",
         "x-api-key": self.kwargs["key"],
         "Authorization": "Bearer {0}".format(self.kwargs["token"])
     }
Пример #7
0
    def setUp(self):
        logging.basicConfig()
        logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
        self.mock_handler = MockLoggingHandler()
        LOGGER.addHandler(self.mock_handler)

        self.mock_finish_upload = mock.patch(
            "wetransfer.api_requests.FinishUpload.create", ).start()
        self.mock_upload_part = mock.patch(
            "wetransfer.items.File.upload_part", ).start()

        self.temp_file = tempfile.NamedTemporaryFile()
        with open(self.temp_file.name, 'w') as f:
            f.write("123456")

        self.item = File(self.temp_file.name)
        self.item.client_options = {}
        self.item.id = 1
Пример #8
0
 def setUp(self):
     logging.basicConfig()
     logging.getLogger("wetransfer-python-sdk").setLevel(logging.DEBUG)
     self.mock_handler = MockLoggingHandler()
     LOGGER.addHandler(self.mock_handler)
     self.httpLogger = HTTPLogger()