Skip to content

Commit 9be3656

Browse files
committed
added test without include_file_versions
1 parent 9078d11 commit 9be3656

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

tests/test_files_ops.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,49 @@ def test_copy_file_succeeds(self) -> None:
19111911
"http://test.com/v1/files/copy", responses.calls[0].request.url
19121912
)
19131913

1914+
@responses.activate
1915+
def test_copy_file_succeeds_without_include_file_versions(self) -> None:
1916+
"""Test copy_file succeeds"""
1917+
1918+
URL.API_BASE_URL = "http://test.com"
1919+
url = "{}/v1/files/copy".format(URL.API_BASE_URL)
1920+
headers = {"Content-Type": "application/json"}
1921+
headers.update(create_headers_for_test())
1922+
responses.add(responses.POST, url, status=204, headers=headers, body="{}")
1923+
1924+
resp = self.client.copy_file(
1925+
options=CopyFileRequestOptions(
1926+
source_file_path=self.source_file_path,
1927+
destination_path=self.destination_path,
1928+
)
1929+
)
1930+
1931+
mock_response_metadata = {
1932+
"headers": {
1933+
"Content-Type": "text/plain, application/json",
1934+
"Accept-Encoding": "gzip, deflate",
1935+
"Authorization": "Basic ZmFrZTEyMjo=",
1936+
},
1937+
"httpStatusCode": 204,
1938+
"raw": None,
1939+
}
1940+
1941+
request_body = make_string_to_single_line(
1942+
"""{
1943+
"sourceFilePath": "/source_file.jpg",
1944+
"destinationPath": "/destination_path"
1945+
}"""
1946+
)
1947+
1948+
self.assertEqual(request_body, responses.calls[0].request.body)
1949+
self.assertEqual(
1950+
camel_dict_to_snake_dict(mock_response_metadata),
1951+
resp.response_metadata.__dict__,
1952+
)
1953+
self.assertEqual(
1954+
"http://test.com/v1/files/copy", responses.calls[0].request.url
1955+
)
1956+
19141957

19151958
class TestMoveFile(ClientTestCase):
19161959
source_file_path = "/source_file.jpg"

0 commit comments

Comments
 (0)