-
Notifications
You must be signed in to change notification settings - Fork 79
Integration tests for private image sharing #632
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
Integration tests for private image sharing #632
Conversation
fb09b29 to
037b305
Compare
037b305 to
744761b
Compare
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.
Pull request overview
This PR adds comprehensive integration tests for the private image sharing feature, specifically focusing on share group operations, image sharing within groups, token management, and member management.
Changes:
- Implements integration tests for share group CRUD operations (create, read, update, delete)
- Adds tests for image sharing within groups including add, get, update, and revoke operations
- Includes tests for token management and member management with error handling scenarios
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert sharegroups_list[0].id > 0 | ||
| assert sharegroups_list[0].description != "" | ||
| assert isinstance(sharegroups_list[0].images_count, int) | ||
| assert sharegroups_list[0].is_suspended == False |
Copilot
AI
Jan 15, 2026
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.
Use 'is False' or 'assert not sharegroups_list[0].is_suspended' instead of '== False' for boolean comparisons to follow Python best practices.
| assert sharegroups_list[0].is_suspended == False | |
| assert not sharegroups_list[0].is_suspended |
| assert share_group.id > 0 | ||
| assert share_group.description == "Test api4python create" | ||
| assert isinstance(share_group.images_count, int) | ||
| assert share_group.is_suspended == False |
Copilot
AI
Jan 15, 2026
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.
Use 'is False' or 'assert not share_group.is_suspended' instead of '== False' for boolean comparisons to follow Python best practices.
| with pytest.raises(RuntimeError) as err: | ||
| share_group.add_member( | ||
| ImageShareGroupMemberToAdd( | ||
| token="notExistingToken", |
Copilot
AI
Jan 15, 2026
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.
The token value 'notExistingToken' uses camelCase which is inconsistent with Python naming conventions. Consider using 'not_existing_token' or 'invalid_token' instead.
| ): | ||
| share_group = test_linode_client.load(ImageShareGroup, share_group_id) | ||
| with pytest.raises(RuntimeError) as err: | ||
| share_group.get_member("notExistingToken") |
Copilot
AI
Jan 15, 2026
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.
The token value 'notExistingToken' uses camelCase which is inconsistent with Python naming conventions. Consider using 'not_existing_token' or 'invalid_token' for consistency.
| with pytest.raises(RuntimeError) as err: | ||
| share_group.update_member( | ||
| ImageShareGroupMemberToUpdate( | ||
| token_uuid="notExistingToken", |
Copilot
AI
Jan 15, 2026
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.
The token value 'notExistingToken' uses camelCase which is inconsistent with Python naming conventions. Consider using 'not_existing_token' or 'invalid_token' for consistency.
| assert "[404] Not found" in str(err.value) | ||
|
|
||
| with pytest.raises(RuntimeError) as err: | ||
| share_group.remove_member("notExistingToken") |
Copilot
AI
Jan 15, 2026
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.
The token value 'notExistingToken' uses camelCase which is inconsistent with Python naming conventions. Consider using 'not_existing_token' or 'invalid_token' for consistency.
ezilber-akamai
left a comment
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.
Tests are mostly looking good! Just a few small things to fix
|
|
||
|
|
||
| def wait_for_image_status( | ||
| test_linode_client, image_id, expected_status, timeout=180, interval=5 |
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.
This step timed out for me locally. Can we increase the timeout?
| group.delete() | ||
|
|
||
|
|
||
| def test_get_share_groups(test_linode_client): |
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.
This test fails for me since a share group is not created before running it. Can you add a step to create a share group before listing them?
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.
Good point, let me add it
135dc82 to
2a9bde9
Compare
181ce47 to
c19136b
Compare
…ests-for-private-image-sharing
jriddle-linode
left a comment
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.
Looks good nice work!
38c0fb9
into
linode:proj/private-image-sharing
✔️ How to Test
make TEST_CASE=test_get_share_groups test-int
make TEST_CASE=test_add_update_remove_share_group test-int
make TEST_CASE=test_add_get_update_revoke_image_to_share_group test-int
make TEST_CASE=test_list_tokens test-int
make TEST_CASE=test_create_token_to_own_share_group_error test-int
make TEST_CASE=test_get_invalid_token test-int
make TEST_CASE=test_try_to_add_member_invalid_token test-int
make TEST_CASE=test_list_share_group_members test-int
make TEST_CASE=test_try_to_get_update_revoke_share_group_member_by_invalid_token test-int