-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dataset): generate upload url independetly (#717)
* feat(Dataset): generate upload url independetly * test(Dataset): test generation of upload url * feat(Dataset): create custom validation error when bucket object exists * feat(Dataset): move deprecated field to a resovler * fix(Datasets): rename uploadUrl mutation to refer to datasets
- Loading branch information
Showing
10 changed files
with
159 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,6 +377,46 @@ def test_create_duplicate(self): | |
with self.assertRaises(IntegrityError): | ||
dataset.create_version(principal=superuser, name="Version 1") | ||
|
||
@mock_gcp_storage | ||
def test_generate_upload_url(self): | ||
superuser = self.create_user("[email protected]", is_superuser=True) | ||
workspace = self.create_workspace( | ||
superuser, | ||
name="My Workspace", | ||
description="Test workspace", | ||
) | ||
dataset = self.create_dataset( | ||
superuser, workspace, "Dataset", "Dataset description" | ||
) | ||
dataset_version = self.create_dataset_version(superuser, dataset=dataset) | ||
self.client.force_login(superuser) | ||
r = self.run_query( | ||
""" | ||
mutation generateDatasetUploadUrl ($input: GenerateDatasetUploadUrlInput!) { | ||
generateDatasetUploadUrl(input: $input) { | ||
uploadUrl | ||
success | ||
errors | ||
} | ||
} | ||
""", | ||
{ | ||
"input": { | ||
"versionId": str(dataset_version.id), | ||
"uri": "uri_file.csv", | ||
"contentType": "text/csv", | ||
} | ||
}, | ||
) | ||
self.assertEqual( | ||
r["data"]["generateDatasetUploadUrl"], | ||
{ | ||
"uploadUrl": f"http://signed-url/{str(dataset.id)}/{str(dataset_version.id)}/uri_file.csv", | ||
"success": True, | ||
"errors": [], | ||
}, | ||
) | ||
|
||
def test_get_file_by_name(self): | ||
self.test_create_dataset_version() | ||
superuser = User.objects.get(email="[email protected]") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters