Skip to content

Commit 604de8f

Browse files
authored
Merge pull request #15 from KhushbooMer/fixes
added fixes for tests
2 parents a2991ff + 18d74b6 commit 604de8f

File tree

1 file changed

+102
-108
lines changed

1 file changed

+102
-108
lines changed

tests/test_files_ops.py

Lines changed: 102 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def test_list_files_succeeds_with_basic_request_tags_with_array(self) -> None:
471471
"createdAt": "2022-06-15T08:19:00.843Z",
472472
"updatedAt": "2022-06-15T08:19:45.169Z",
473473
"fileId": "62a995f4d875ec08dc587b72",
474-
"tags": ["{Tag_1", " Tag_2", " Tag_3}", "tag-to-add-2"],
474+
"tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"],
475475
"AITags": "",
476476
"versionInfo": {
477477
"id": "62a995f4d875ec08dc587b72",
@@ -536,7 +536,7 @@ def test_list_files_succeeds_with_basic_request_tags_with_array(self) -> None:
536536
"mime": "image/jpeg",
537537
"name": "sample-cat-image_gr64HPlJS.jpg",
538538
"size": 23023,
539-
"tags": ["{Tag_1", " Tag_2", " Tag_3}", "tag-to-add-2"],
539+
"tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"],
540540
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/sample-cat-image_gr64HPlJS.jpg",
541541
"type": "file",
542542
"updatedAt": "2022-06-15T08:19:45.169Z",
@@ -577,7 +577,7 @@ def test_list_files_succeeds_with_basic_request(self) -> None:
577577
"createdAt": "2022-06-15T08:19:00.843Z",
578578
"updatedAt": "2022-06-15T08:19:45.169Z",
579579
"fileId": "62a995f4d875ec08dc587b72",
580-
"tags": ["{Tag_1", " Tag_2", " Tag_3}", "tag-to-add-2"],
580+
"tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"],
581581
"AITags": "",
582582
"versionInfo": {
583583
"id": "62a995f4d875ec08dc587b72",
@@ -642,7 +642,7 @@ def test_list_files_succeeds_with_basic_request(self) -> None:
642642
"mime": "image/jpeg",
643643
"name": "sample-cat-image_gr64HPlJS.jpg",
644644
"size": 23023,
645-
"tags": ["{Tag_1", " Tag_2", " Tag_3}", "tag-to-add-2"],
645+
"tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"],
646646
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/sample-cat-image_gr64HPlJS.jpg",
647647
"type": "file",
648648
"updatedAt": "2022-06-15T08:19:45.169Z",
@@ -1661,8 +1661,8 @@ def test_get_file_versions_succeeds_with_id(self):
16611661
"test10": 11
16621662
},
16631663
"isPrivateFile": false,
1664-
"url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg?ik-obj-version =dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz",
1665-
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version =dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz",
1664+
"url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz",
1665+
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz",
16661666
"fileType": "image",
16671667
"filePath": "/new_car.jpg",
16681668
"height": 354,
@@ -1675,111 +1675,105 @@ def test_get_file_versions_succeeds_with_id(self):
16751675
)
16761676
resp = self.client.get_file_versions(self.file_id)
16771677
mock_response_metadata = {
1678-
"headers": {
1679-
"Content-Type": "text/plain, application/json",
1680-
"Authorization": "Basic ZmFrZTEyMjo=",
1681-
},
1682-
"http_status_code": 200,
1683-
"raw": [
1684-
{
1685-
"AITags": [
1686-
{
1687-
"confidence": 98.77,
1688-
"name": "Clothing",
1689-
"source": "google-auto-tagging",
1690-
},
1691-
{
1692-
"confidence": 95.31,
1693-
"name": "Smile",
1694-
"source": "google-auto-tagging",
1695-
},
1696-
{
1697-
"confidence": 95.2,
1698-
"name": "Shoe",
1699-
"source": "google-auto-tagging",
1700-
},
1701-
],
1702-
"createdAt": "2022-06-15T11:34:36.294Z",
1703-
"customCoordinates": "",
1704-
"customMetadata": {"test10": 11, "test100": 10},
1705-
"embeddedMetadata": {
1706-
"DateCreated": "2022-07-04T10:15:50.066Z",
1707-
"DateTimeCreated": "2022-07-04T10:15:50.066Z",
1708-
},
1709-
"fileId": "fake_123",
1710-
"filePath": "/new_car.jpg",
1711-
"fileType": "image",
1712-
"hasAlpha": False,
1713-
"height": 354,
1714-
"isPrivateFile": False,
1715-
"mime": "image/jpeg",
1716-
"name": "new_car.jpg",
1717-
"size": 7390,
1718-
"tags": ["Tag_1", "Tag_2", "Tag_3"],
1719-
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg",
1720-
"type": "file",
1721-
"updatedAt": "2022-07-04T10:15:50.067Z",
1722-
"url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg",
1723-
"versionInfo": {"id": "versionId", "name": "Version 4"},
1724-
"width": 236,
1678+
'raw': [{
1679+
'type': 'file',
1680+
'name': 'new_car.jpg',
1681+
'createdAt': '2022-06-15T11:34:36.294Z',
1682+
'updatedAt': '2022-07-04T10:15:50.067Z',
1683+
'fileId': 'fake_123',
1684+
'tags': ['Tag_1', 'Tag_2', 'Tag_3'],
1685+
'AITags': [{
1686+
'name': 'Clothing',
1687+
'confidence': 98.77,
1688+
'source': 'google-auto-tagging'
1689+
}, {
1690+
'name': 'Smile',
1691+
'confidence': 95.31,
1692+
'source': 'google-auto-tagging'
1693+
}, {
1694+
'name': 'Shoe',
1695+
'confidence': 95.2,
1696+
'source': 'google-auto-tagging'
1697+
}],
1698+
'versionInfo': {
1699+
'id': 'versionId',
1700+
'name': 'Version 4'
17251701
},
1726-
{
1727-
"AITags": [
1728-
{
1729-
"confidence": 98.77,
1730-
"name": "Clothing",
1731-
"source": "google-auto-tagging",
1732-
},
1733-
{
1734-
"confidence": 95.31,
1735-
"name": "Smile",
1736-
"source": "google-auto-tagging",
1737-
},
1738-
{
1739-
"confidence": 95.2,
1740-
"name": "Shoe",
1741-
"source": "google-auto-tagging",
1742-
},
1743-
{
1744-
"confidence": 91.05,
1745-
"name": "Street light",
1746-
"source": "google-auto-tagging",
1747-
},
1748-
],
1749-
"createdAt": "2022-07-04T10:15:49.698Z",
1750-
"customCoordinates": "10,10,40,40",
1751-
"customMetadata": {"test10": 11, "test100": 10},
1752-
"embeddedMetadata": {
1753-
"DateCreated": "2022-06-15T11:34:36.702Z",
1754-
"DateTimeCreated": "2022-06-15T11:34:36.702Z",
1755-
"XResolution": 250,
1756-
"YResolution": 250,
1757-
},
1758-
"fileId": "fileId",
1759-
"filePath": "/new_car.jpg",
1760-
"fileType": "image",
1761-
"hasAlpha": False,
1762-
"height": 354,
1763-
"isPrivateFile": False,
1764-
"mime": "image/jpeg",
1765-
"name": "new_car.jpg",
1766-
"size": 23023,
1767-
"tags": ["Tag_1", "Tag_2", "Tag_3"],
1768-
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version "
1769-
"=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz",
1770-
"type": "file-version",
1771-
"updatedAt": "2022-07-04T10:15:49.734Z",
1772-
"url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg?ik-obj-version "
1773-
"=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz",
1774-
"versionInfo": {
1775-
"id": "62c2bdd5872375c6b8f40fd4",
1776-
"name": "Version 1",
1777-
},
1778-
"width": 236,
1702+
'embeddedMetadata': {
1703+
'DateCreated': '2022-07-04T10:15:50.066Z',
1704+
'DateTimeCreated': '2022-07-04T10:15:50.066Z'
17791705
},
1780-
],
1706+
'customCoordinates': '',
1707+
'customMetadata': {
1708+
'test100': 10,
1709+
'test10': 11
1710+
},
1711+
'isPrivateFile': False,
1712+
'url': 'https://ik.imagekit.io/your_imagekit_id/new_car.jpg',
1713+
'thumbnail': 'https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg',
1714+
'fileType': 'image',
1715+
'filePath': '/new_car.jpg',
1716+
'height': 354,
1717+
'width': 236,
1718+
'size': 7390,
1719+
'hasAlpha': False,
1720+
'mime': 'image/jpeg'
1721+
}, {
1722+
'type': 'file-version',
1723+
'name': 'new_car.jpg',
1724+
'createdAt': '2022-07-04T10:15:49.698Z',
1725+
'updatedAt': '2022-07-04T10:15:49.734Z',
1726+
'fileId': 'fileId',
1727+
'tags': ['Tag_1', 'Tag_2', 'Tag_3'],
1728+
'AITags': [{
1729+
'name': 'Clothing',
1730+
'confidence': 98.77,
1731+
'source': 'google-auto-tagging'
1732+
}, {
1733+
'name': 'Smile',
1734+
'confidence': 95.31,
1735+
'source': 'google-auto-tagging'
1736+
}, {
1737+
'name': 'Shoe',
1738+
'confidence': 95.2,
1739+
'source': 'google-auto-tagging'
1740+
}, {
1741+
'name': 'Street light',
1742+
'confidence': 91.05,
1743+
'source': 'google-auto-tagging'
1744+
}],
1745+
'versionInfo': {
1746+
'id': '62c2bdd5872375c6b8f40fd4',
1747+
'name': 'Version 1'
1748+
},
1749+
'embeddedMetadata': {
1750+
'XResolution': 250,
1751+
'YResolution': 250,
1752+
'DateCreated': '2022-06-15T11:34:36.702Z',
1753+
'DateTimeCreated': '2022-06-15T11:34:36.702Z'
1754+
},
1755+
'customCoordinates': '10,10,40,40',
1756+
'customMetadata': {
1757+
'test100': 10,
1758+
'test10': 11
1759+
},
1760+
'isPrivateFile': False,
1761+
'url': 'https://ik.imagekit.io/your_imagekit_id/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz',
1762+
'thumbnail': 'https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz',
1763+
'fileType': 'image',
1764+
'filePath': '/new_car.jpg',
1765+
'height': 354,
1766+
'width': 236,
1767+
'size': 23023,
1768+
'hasAlpha': False,
1769+
'mime': 'image/jpeg'
1770+
}],
1771+
'http_status_code': 200,
1772+
'headers': {
1773+
'Content-Type': 'text/plain, application/json',
1774+
'Authorization': 'Basic ZmFrZTEyMjo='
1775+
}
17811776
}
1782-
17831777
self.assertEqual(
17841778
camel_dict_to_snake_dict(mock_response_metadata),
17851779
resp.response_metadata.__dict__,

0 commit comments

Comments
 (0)