Skip to content

Conversation

@psnoch-akamai
Copy link
Contributor

✔️ 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

@psnoch-akamai psnoch-akamai force-pushed the TPT-3958-integration-tests-for-private-image-sharing branch from fb09b29 to 037b305 Compare January 15, 2026 15:23
@psnoch-akamai psnoch-akamai force-pushed the TPT-3958-integration-tests-for-private-image-sharing branch from 037b305 to 744761b Compare January 15, 2026 15:39
Copy link
Contributor

Copilot AI left a 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
Copy link

Copilot AI Jan 15, 2026

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.

Suggested change
assert sharegroups_list[0].is_suspended == False
assert not sharegroups_list[0].is_suspended

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jan 15, 2026

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.

Copilot uses AI. Check for mistakes.
with pytest.raises(RuntimeError) as err:
share_group.add_member(
ImageShareGroupMemberToAdd(
token="notExistingToken",
Copy link

Copilot AI Jan 15, 2026

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.

Copilot uses AI. Check for mistakes.
):
share_group = test_linode_client.load(ImageShareGroup, share_group_id)
with pytest.raises(RuntimeError) as err:
share_group.get_member("notExistingToken")
Copy link

Copilot AI Jan 15, 2026

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.

Copilot uses AI. Check for mistakes.
with pytest.raises(RuntimeError) as err:
share_group.update_member(
ImageShareGroupMemberToUpdate(
token_uuid="notExistingToken",
Copy link

Copilot AI Jan 15, 2026

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.

Copilot uses AI. Check for mistakes.
assert "[404] Not found" in str(err.value)

with pytest.raises(RuntimeError) as err:
share_group.remove_member("notExistingToken")
Copy link

Copilot AI Jan 15, 2026

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a 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
Copy link
Contributor

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):
Copy link
Contributor

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?

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants