Skip to content

Commit

Permalink
YDA-5150: Add ability for priv rodsuser to create datamanager group
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox authored Nov 22, 2023
1 parent 042d2ba commit 10eebe6
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 94 deletions.
72 changes: 47 additions & 25 deletions tests/features/api/api_group.feature
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,26 @@ Feature: Group API
And the group "<group_name>" is created

Examples:
| user | group_name |
| functionaladminpriv | research-api-test-group |
| technicaladmin | datamanager-api-test-group |
| technicaladmin | testGroupie |
| user | group_name |
| functionaladminpriv | research-api-test-group |
| functionaladminpriv | research-api-test1-group |
| technicaladmin | not-a-yoda-group |


Scenario Outline: Datamanager group creation
Given user <user> is authenticated
And the group "<group_name>" does not exist
And the user creates a new datamanager group "<group_name>"
Then the response status code is "200"
And the group "<group_name>" is created
# api-test is for creating a datamanager group with functionaladminpriv.
# api-test1 is for making sure that can still create a datamanager
# group with technical admin.

Examples:
| user | group_name |
| functionaladminpriv | datamanager-api-test |
| technicaladmin | datamanager-api-test1 |


Scenario Outline: Group update
Expand All @@ -75,10 +91,11 @@ Feature: Group API
And the update to group "<group_name>" is persisted

Examples:
| user | group_name |
| functionaladminpriv | research-api-test-group |
| technicaladmin | datamanager-api-test-group |
| technicaladmin | testGroupie |
| user | group_name |
| functionaladminpriv | research-api-test-group |
| functionaladminpriv | datamanager-api-test |
| technicaladmin | datamanager-api-test1 |
| technicaladmin | not-a-yoda-group |


Scenario Outline: Adding user to group
Expand All @@ -89,10 +106,11 @@ Feature: Group API
And user "sterlingarcher" is now a member of the group "<group_name>"

Examples:
| user | group_name |
| functionaladminpriv | research-api-test-group |
| technicaladmin | datamanager-api-test-group |
| technicaladmin | testGroupie |
| user | group_name |
| functionaladminpriv | research-api-test-group |
| functionaladminpriv | datamanager-api-test |
| technicaladmin | datamanager-api-test1 |
| technicaladmin | not-a-yoda-group |


Scenario Outline: Group user update role
Expand All @@ -103,10 +121,11 @@ Feature: Group API
And the role of user "sterlingarcher" in group "<group_name>" is updated

Examples:
| user | group_name |
| functionaladminpriv | research-api-test-group |
| technicaladmin | datamanager-api-test-group |
| technicaladmin | testGroupie |
| user | group_name |
| functionaladminpriv | research-api-test-group |
| functionaladminpriv | datamanager-api-test |
| technicaladmin | datamanager-api-test1 |
| technicaladmin | not-a-yoda-group |


Scenario Outline: Remove user from group
Expand All @@ -117,10 +136,11 @@ Feature: Group API
And user "sterlingarcher" is no longer a member of the group "<group_name>"

Examples:
| user | group_name |
| functionaladminpriv | research-api-test-group |
| technicaladmin | datamanager-api-test-group |
| technicaladmin | testGroupie |
| user | group_name |
| functionaladminpriv | research-api-test-group |
| functionaladminpriv | datamanager-api-test |
| technicaladmin | datamanager-api-test1 |
| technicaladmin | not-a-yoda-group |


Scenario Outline: Group import CSV
Expand All @@ -142,8 +162,10 @@ Feature: Group API
And the group "<group_name>" no longer exists

Examples:
| user | group_name |
| functionaladminpriv | research-api-test-group |
| technicaladmin | datamanager-api-test-group |
| technicaladmin | testGroupie |
| technicaladmin | research-csvtestgroup |
| user | group_name |
| functionaladminpriv | research-api-test-group |
| functionaladminpriv | datamanager-api-test |
| functionaladminpriv | research-api-test1-group |
| technicaladmin | datamanager-api-test1 |
| technicaladmin | research-csvtestgroup |
| technicaladmin | not-a-yoda-group |
32 changes: 19 additions & 13 deletions tests/features/ui/ui_group.feature
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Feature: Group UI


Scenario Outline: Group research create with default schema id
Given user functionaladminpriv is logged in
Given user <user> is logged in
And module "group_manager" is shown
When user opens add group dialog
And groupname is set to <group>
Expand All @@ -106,8 +106,10 @@ Feature: Group UI
And check whether research group properties <group>, <category>, <subcategory> and <expiration_date> for user functionaladminpriv

Examples:
| category | subcategory | group | expiration_date |
| test-automation | test-automation | ui-test-group | 2030-12-25 |
| user | category | subcategory | group | expiration_date |
| functionaladminpriv | test-automation | test-automation | ui-test-group | 2030-12-25 |
| functionaladminpriv | test-datamanager | test-datamanager | test-datamanager | 2030-12-25 |
| technicaladmin | test-datamanager1 | test-datamanager1 | test-datamanager1 | 2030-12-25 |


Scenario Outline: Create new research group starting from same (sub)category of active group at that moment
Expand Down Expand Up @@ -141,7 +143,7 @@ Feature: Group UI


Scenario Outline: Group datamanager create
Given user technicaladmin is logged in
Given user <user> is logged in
And module "group_manager" is shown
When user opens add group dialog
And category is set to <category>
Expand All @@ -152,8 +154,9 @@ Feature: Group UI
And check whether datamanager group properties <group> and <category> are correct

Examples:
| category | subcategory | group |
| test-datamanager | test-datamanager | test-datamanager |
| user | category | subcategory | group |
| functionaladminpriv | test-datamanager | test-datamanager | test-datamanager |
| technicaladmin | test-datamanager1 | test-datamanager1 | test-datamanager1 |


Scenario Outline: Group remove
Expand All @@ -164,13 +167,16 @@ Feature: Group UI
And user confirms group removal

Examples:
| user | category | subcategory | group |
| functionaladminpriv | test-automation | test-automation | research-ui-test-group |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group1 |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group2 |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group3 |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group4 |
| technicaladmin | test-datamanager | test-datamanager | datamanager-test-datamanager |
| user | category | subcategory | group |
| functionaladminpriv | test-automation | test-automation | research-ui-test-group |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group1 |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group2 |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group3 |
| functionaladminpriv | test-automation | csv-test | research-csv-test-group4 |
| functionaladminpriv | test-datamanager | test-datamanager | datamanager-test-datamanager |
| functionaladminpriv | test-datamanager | test-datamanager | research-test-datamanager |
| technicaladmin | test-datamanager1 | test-datamanager1 | datamanager-test-datamanager1 |
| technicaladmin | test-datamanager1 | test-datamanager1 | research-test-datamanager1 |


Scenario Outline: Select group in tree view and check group properties are set and active in tree view
Expand Down
21 changes: 19 additions & 2 deletions tests/step_defs/api/test_api_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,36 @@ def api_group_does_not_exist(user, group_name):

@given(parsers.parse('the user creates a new group "{group_name}"'), target_fixture="api_response")
def api_group_create(user, group_name):
cat_and_subcat = "-".join(group_name.split("-")[1:-1])
return api_request(
user,
"group_create",
{"group_name": group_name,
"category": "api-test",
"subcategory": "api-test",
"category": cat_and_subcat,
"subcategory": cat_and_subcat,
"schema_id": "default-2",
"expiration_date": "",
"description": "",
"data_classification": "public"}
)


@given(parsers.parse('the user creates a new datamanager group "{group_name}"'), target_fixture="api_response")
def api_datamanager_group_create(user, group_name):
cat_and_subcat = group_name.split("-", 1)[1]
return api_request(
user,
"group_create",
{"group_name": group_name,
"category": cat_and_subcat,
"subcategory": cat_and_subcat,
"schema_id": "",
"expiration_date": "",
"description": "",
"data_classification": ""}
)


@given(parsers.parse('the group "{group_name}" exists'))
def given_group_exists(user, group_name):
_, body = api_request(
Expand Down
24 changes: 7 additions & 17 deletions tests/step_defs/ui/test_ui_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,39 +444,29 @@ def ui_group_schema_category_is_updated(browser, category):

@when(parsers.parse("subcategory is set to {subcategory}"))
def ui_group_schema_subcategory_is_set(browser, subcategory):
# Subcategory already exists.
browser.find_by_css('#f-group-create-subcategory').find_by_xpath('..').find_by_css('span .select2-selection').click()
time.sleep(1)
browser.find_by_css('.select2-search__field').fill(subcategory)
time.sleep(1)
options = browser.find_by_css('#select2-f-group-create-subcategory-results')
for option in options:
if option.text == subcategory:
if subcategory in option.text:
option.click()
return True

# Subcategory does not exist.
time.sleep(1)
browser.find_by_css('.select2-search__field').fill(subcategory)
time.sleep(1)
browser.find_by_css('.select2-results__option--highlighted').click()


@when(parsers.parse("subcategory is updated to {subcategory}"))
def ui_group_schema_subcategory_is_updated(browser, subcategory):
# Subcategory already exists.
browser.find_by_css('#f-group-update-subcategory').find_by_xpath('..').find_by_css('span .select2-selection').click()
time.sleep(1)
options = browser.find_by_css('#select2-f-group-create-subcategory-results')
browser.find_by_css('.select2-search__field').fill(subcategory)
time.sleep(1)
options = browser.find_by_css('#select2-f-group-update-subcategory-results')
for option in options:
if option.text == subcategory:
if subcategory in option.text:
option.click()
return True

# Subcategory does not exist.
time.sleep(1)
browser.find_by_css('.select2-search__field').fill(subcategory)
time.sleep(1)
browser.find_by_css('.select2-results__option--highlighted').click()


@when(parsers.parse("schema id is set to {schema_id}"))
def ui_group_schema_set_schema_id(browser, schema_id):
Expand Down
2 changes: 1 addition & 1 deletion uuGroup.r
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ uuGroupAdd(*groupName, *category, *subcategory, *schema_id, *expiration_date, *d
*kv."category" = *category;
*kv."subcategory" = *subcategory;
*kv."schema_id" = *schema_id;
*kv."expiration_date" = *expiration_date;
*kv."expiration_date" = *expiration_date;
*kv."description" = *description;
*kv."data_classification" = *dataClassification;
*kv."co_identifier" = *co_identifier;
Expand Down
Loading

0 comments on commit 10eebe6

Please sign in to comment.