<commit_before>@RALLY_US187
@RALLY_US185
@RALLY_US103
Feature: Application Authorization Tool
As an SEA or LEA  Administrator / Operator, I want to be able to allow specific applications access to my district(s) data

	Scenario: District Super Administrator logs in to the authorization tool
	
	Given I have an open web browser
	Given I am a valid District Super Administrator for "Sunset School District"
	When I hit the Admin Application Authorization Tool
	And I was redirected to the "Simple" IDP Login page
	When I submit the credentials "sunsetadmin" "<PASSWORD>" for the "Simple" login page
	Then I am redirected to the Admin Application Authorization Tool
	And I see a label in the middle "IL-SUNSET"
	And I see the list of all available apps on SLI
	And the authorized apps for my district are colored green
	And the unauthorized are colored red
	And are sorted by 'Status'
	And I see the Name, Version, Vendor and Status of the apps

Scenario: Non SLI-hosted valid user tries to access the Application Authorization Tool
	Given I have an open web browser
	When I hit the Admin Application Authorization Tool
     And I submit the credentials "administrator" "administrator1234" for the "Simple" login page
     Then the api should generate a 403 error

@DE_2690
Scenario: Deny application
  
  Given I am an authenticated District Super Administrator for "Sunset School District"
  And I am logged into the Application Authorization Tool
  And I see an application "SDK Sample" in the table
  And in Status it says "Approved"
  And I click on the "Deny" button next to it
  And I am asked 'Do you really want deny access to this application of the district's data'
  When I click on Ok
  Then the application is denied to use data of "Sunset School District"
  And the app "SDK Sample" Status becomes "Not Approved"
  And it is colored "red"
  And the Approve button next to it is enabled
  And the Deny button next to it is disabled
  
Scenario: Approve application
	
	Given I am an authenticated District Super Administrator for "Sunset School District"
	And I am logged into the Application Authorization Tool
	And I see an application "SDK Sample" in the table
	And in Status it says "Not Approved"
	And I click on the "Approve" button next to it
	And I am asked 'Do you really want this application to access the district's data'
	When I click on Ok
	Then the application is authorized to use data of "Sunset School District"
	And the app "SDK Sample" Status becomes "Approved"
	And it is colored "green"
	And the Approve button next to it is disabled
	And the Deny button next to it is enabled<commit_msg>us5758 - draft admin approve/deny application security event tests<commit_after>@RALLY_US187
@RALLY_US185
@RALLY_US103
Feature: Application Authorization Tool
As an SEA or LEA  Administrator / Operator, I want to be able to allow specific applications access to my district(s) data

	Scenario: District Super Administrator logs in to the authorization tool
	
	Given I have an open web browser
	Given I am a valid District Super Administrator for "Sunset School District"
	When I hit the Admin Application Authorization Tool
	And I was redirected to the "Simple" IDP Login page
	When I submit the credentials "sunsetadmin" "<PASSWORD>" for the "Simple" login page
	Then I am redirected to the Admin Application Authorization Tool
	And I see a label in the middle "IL-SUNSET"
	And I see the list of all available apps on SLI
	And the authorized apps for my district are colored green
	And the unauthorized are colored red
	And are sorted by 'Status'
	And I see the Name, Version, Vendor and Status of the apps

Scenario: Non SLI-hosted valid user tries to access the Application Authorization Tool
	Given I have an open web browser
	When I hit the Admin Application Authorization Tool
     And I submit the credentials "administrator" "<PASSWORD>" for the "Simple" login page
     Then the api should generate a 403 error

@DE_2690
Scenario: Deny application
  
  Given I am an authenticated District Super Administrator for "Sunset School District"
   And I am logged into the Application Authorization Tool
   And the sli securityEvent collection is empty
   And I see an application "SDK Sample" in the table
   And in Status it says "Approved"
   And I click on the "Deny" button next to it
   And I am asked 'Do you really want deny access to this application of the district's data'
  When I click on Ok
  Then the application is denied to use data of "Sunset School District"
   And the app "SDK Sample" Status becomes "Not Approved"
   And it is colored "red"
   And the Approve button next to it is enabled
   And the Deny button next to it is disabled
   And a security event matching "^Application Denied" should be in the sli db
   And I check to find if record is in sli db collection:
    | collectionName      | expectedRecordCount | searchParameter       | searchValue |
    | securityEvent       | 1                   | body.userEdOrg        | IL          |
    | securityEvent       | 1                   | body.targetEdOrgList  | IL-SUNSET   |
  
Scenario: Approve application
	
	Given I am an authenticated District Super Administrator for "Sunset School District"
	 And I am logged into the Application Authorization Tool
	 And the sli securityEvent collection is empty
	 And I see an application "SDK Sample" in the table
	 And in Status it says "Not Approved"
	 And I click on the "Approve" button next to it
	 And I am asked 'Do you really want this application to access the district's data'
	When I click on Ok
	Then the application is authorized to use data of "Sunset School District"
	 And the app "SDK Sample" Status becomes "Approved"
	 And it is colored "green"
	 And the Approve button next to it is disabled
	 And the Deny button next to it is enabled
	 And a security event matching "^Application Approved" should be in the sli db
     And I check to find if record is in sli db collection:
      | collectionName      | expectedRecordCount | searchParameter       | searchValue |
      | securityEvent       | 1                   | body.userEdOrg        | IL          |
      | securityEvent       | 1                   | body.targetEdOrgList  | IL-SUNSET   |
{'fraction_non_alphanumeric': 0.03347280334728033, 'fraction_numerical': 0.007080785323463148, 'mean_word_length': 3.539810080350621, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1090233', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1561, 'n_words': 950}