Skip to content
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

add group/consumption_role invite/remove tests #1387

Merged
merged 3 commits into from
Jul 9, 2024
Merged

Conversation

petrkalos
Copy link
Contributor

@petrkalos petrkalos commented Jul 3, 2024

Feature or Bugfix

  • Feature

Detail

Not fully tested since my environment is down

>make integrations-tests
...
29 passed, 1 warning in 770.09s (0:12:50) 

Relates

Security

Please answer the questions below briefly where applicable, or write N/A. Based on
OWASP 10.

  • Does this PR introduce or modify any input fields or queries - this includes
    fetching data from storage outside the application (e.g. a database, an S3 bucket)?
    • Is the input sanitized?
    • What precautions are you taking before deserializing the data you consume?
    • Is injection prevented by parametrizing queries?
    • Have you ensured no eval or similar functions are used?
  • Does this PR introduce any functionality or component that requires authorization?
    • How have you ensured it respects the existing AuthN/AuthZ mechanisms?
    • Are you logging failed auth attempts?
  • Are you using or adding any cryptographic features?
    • Do you use a standard proven implementations?
    • Are the used keys controlled by the customer? Where are they stored?
  • Are you introducing any new policies/roles/users?
    • Have you used the least-privilege principle? How?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@petrkalos petrkalos requested a review from noah-paige July 3, 2024 14:53
)
finally:
if consumption_role:
assert_that(remove_consumption_role(client1, env_uri, consumption_role.consumptionRoleUri)).is_true()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we run an additional assert to ensure separate client (i.e. client2) cannot remove the consumption role that it does not own

Comment on lines 65 to 68
def test_invite_group_on_env_no_org(client1, session_env2, group3):
assert_that(invite_group_on_env).raises(GqlError).when_called_with(
client1, session_env2.environmentUri, group3, ['CREATE_DATASET']
).contains(group3, 'is not a member of the organization')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe group3 is invited to org2 which is where session_env2 is created in

Should this be group4 instead - in my testing this does not pass as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely right, fixing it on next push.

@noah-paige
Copy link
Contributor

Left some comments (mostly minor) on the files changed. Also when testing I think some of the organization tests may have broken from the changes made, mainly:

  • test_list_organizations_with_unauthorized_team - need to update from client3 to client4 since 3 is now invited to org2 (or update the assertion node length check)

  • test_get_organization_organization_with_invited_team response group stats need to be updated from 1 to 2 since 3 is now invited to org2

@petrkalos
Copy link
Contributor Author

Left some comments (mostly minor) on the files changed. Also when testing I think some of the organization tests may have broken from the changes made, mainly:

  • test_list_organizations_with_unauthorized_team - need to update from client3 to client4 since 3 is now invited to org2 (or update the assertion node length check)
  • test_get_organization_organization_with_invited_team response group stats need to be updated from 1 to 2 since 3 is now invited to org2

Thanks for reviewing Noah, indeed those tests were broken, my env was down and couldn't test them before pushing the PR. They are now fixed.

@petrkalos petrkalos requested a review from noah-paige July 5, 2024 12:20
Copy link
Contributor

@noah-paige noah-paige left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@petrkalos petrkalos merged commit c038569 into main Jul 9, 2024
9 checks passed
@dlpzx dlpzx deleted the feature/env_tests branch September 11, 2024 11:24
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