-
Notifications
You must be signed in to change notification settings - Fork 8
Fix 462 #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Fix 462 #463
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
13bdbc0
Single method to get and set the upload status in db.
gusmith bbadadd
4 states for uploaded in the dataprovider table.
gusmith 784ef41
Use the state `done` instead of the boolean TRUE.
gusmith 3d8890b
Two new tests related to this new feature.
gusmith 56b5fc1
The main change when posting clks to a project, check that we can pos…
gusmith 104f49e
Tiny cleanup of a variable.
gusmith 08fc85b
Some comments in the tests.
gusmith db74fc0
Update changelo
gusmith 0680f36
Typo in changelog
gusmith 83263ba
Clean test and modifying variable name.
gusmith 5474008
Rename method to update upload state and add nicer documentation.
gusmith ce02a82
Change dur to remanimg
gusmith 13e65da
Rename the test methods to be more explicit.
gusmith e5a7b7b
Rename an enum and add documentation about them.
gusmith 3a30ad2
Typos.
gusmith 7216f31
Rename again a test method.
gusmith 6a68f18
Documentation correction from PR review.
gusmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Two new tests related to this new feature.
One checking that re-using a token fails. One checking that uploading failing data does not block the project (can re-upload).
- Loading branch information
commit 3d8890b8afde017c1d89bf256b49b589336816db
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -235,3 +235,51 @@ def test_project_single_party_empty_data_upload( | |
| ) | ||
| assert r.status_code == 400 | ||
|
|
||
|
|
||
| def test_project_upload_wrong_authentication(requests, valid_project_params): | ||
| expected_number_parties = get_expected_number_parties(valid_project_params) | ||
| if expected_number_parties < 2: | ||
| # The test is not made for less than two parties | ||
| return | ||
|
|
||
| new_project_data = requests.post(url + '/projects', | ||
| json={ | ||
| 'schema': {}, | ||
| **valid_project_params | ||
| }).json() | ||
| update_tokens = new_project_data['update_tokens'] | ||
|
|
||
| assert len(update_tokens) == expected_number_parties | ||
|
|
||
| small_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'testdata/clks_128B_1k.bin') | ||
| token_to_reuse = update_tokens[0] | ||
| upload_binary_data_from_file( | ||
| requests, | ||
| small_file_path, new_project_data['project_id'], token_to_reuse, 1000) | ||
|
|
||
| upload_binary_data_from_file( | ||
| requests, | ||
| small_file_path, new_project_data['project_id'], token_to_reuse, 1000, expected_status_code=403) | ||
|
|
||
|
|
||
| def test_project_upload_fail_then_works(requests, valid_project_params): | ||
|
||
| expected_number_parties = get_expected_number_parties(valid_project_params) | ||
|
|
||
| new_project_data = requests.post(url + '/projects', | ||
| json={ | ||
| 'schema': {}, | ||
| **valid_project_params | ||
| }).json() | ||
| update_tokens = new_project_data['update_tokens'] | ||
|
|
||
| assert len(update_tokens) == expected_number_parties | ||
|
|
||
| small_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'testdata/clks_128B_1k.bin') | ||
| token_to_reuse = update_tokens[0] | ||
| upload_binary_data_from_file( | ||
| requests, | ||
| small_file_path, new_project_data['project_id'], token_to_reuse, 2000, expected_status_code=400) | ||
|
|
||
| upload_binary_data_from_file( | ||
| requests, | ||
| small_file_path, new_project_data['project_id'], token_to_reuse, 1000) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can be more specific here. You are testing that you cannot upload twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍