-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1114 from neicnordic/feature/sda-admin-dataset-user
[sda-admin] Add user to create dataset command
- Loading branch information
Showing
4 changed files
with
22 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,10 +46,10 @@ sda-admin file set-accession -filepath /path/to/file.c4gh -user test-user@exampl | |
|
||
## Create a dataset from a list of accession IDs and a dataset ID | ||
|
||
Use the following command to create a dataset `dataset001` from accession IDs `my-accession-id-1` and `my-accession-id-2` | ||
Use the following command to create a dataset `dataset001` from accession IDs `my-accession-id-1` and `my-accession-id-2` for files that belongs to the user `[email protected]` | ||
|
||
```sh | ||
sda-admin dataset create -dataset-id dataset001 my-accession-id-1 my-accession-id-2 | ||
sda-admin dataset create -user [email protected] -dataset-id dataset001 my-accession-id-1 my-accession-id-2 | ||
``` | ||
|
||
## Release a dataset for downloading | ||
|
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 |
---|---|---|
|
@@ -28,13 +28,14 @@ func TestCreate_Success(t *testing.T) { | |
|
||
expectedURL := "http://example.com/dataset/create" | ||
token := "test-token" | ||
user := "[email protected]" | ||
datasetID := "dataset-123" | ||
accessionIDs := []string{"accession-1", "accession-2"} | ||
jsonBody := []byte(`{"accession_ids":["accession-1","accession-2"],"dataset_id":"dataset-123"}`) | ||
jsonBody := []byte(`{"accession_ids":["accession-1","accession-2"],"dataset_id":"dataset-123","user":"[email protected]"}`) | ||
|
||
mockHelpers.On("PostRequest", expectedURL, token, jsonBody).Return([]byte(`{}`), nil) | ||
|
||
err := Create("http://example.com", token, datasetID, accessionIDs) | ||
err := Create("http://example.com", token, datasetID, user, accessionIDs) | ||
assert.NoError(t, err) | ||
mockHelpers.AssertExpectations(t) | ||
} | ||
|
@@ -47,13 +48,14 @@ func TestCreate_PostRequestFailure(t *testing.T) { | |
|
||
expectedURL := "http://example.com/dataset/create" | ||
token := "test-token" | ||
user := "[email protected]" | ||
datasetID := "dataset-123" | ||
accessionIDs := []string{"accession-1", "accession-2"} | ||
jsonBody := []byte(`{"accession_ids":["accession-1","accession-2"],"dataset_id":"dataset-123"}`) | ||
jsonBody := []byte(`{"accession_ids":["accession-1","accession-2"],"dataset_id":"dataset-123","user":"[email protected]"}`) | ||
|
||
mockHelpers.On("PostRequest", expectedURL, token, jsonBody).Return([]byte(nil), errors.New("failed to send request")) | ||
|
||
err := Create("http://example.com", token, datasetID, accessionIDs) | ||
err := Create("http://example.com", token, datasetID, user, accessionIDs) | ||
assert.Error(t, err) | ||
assert.EqualError(t, err, "failed to send request") | ||
mockHelpers.AssertExpectations(t) | ||
|
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