Skip to content

Commit 45b5eb5

Browse files
authored
Remove references to MINDER_PROVIDER. (#27)
Currently tested API do not need `context.provider` to be set, so let's make things simpler. Also, removed a few keywords that were either unused or unnecessary, to facilitate future refactoring.
1 parent 79ccaf0 commit 45b5eb5

File tree

10 files changed

+11
-63
lines changed

10 files changed

+11
-63
lines changed

minder-tests/api-history.robot

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ Test Teardown Default Teardown
1313

1414
*** Keywords ***
1515
Default Setup
16-
Set Provider as Environment Variable with Test Name
1716
Set Project as Environment Variable with Test Name
1817
Ruletypes are ready
1918
Ruletypes are created
2019
${MINDER_TEST_ORG}= Get Environment Variable MINDER_TEST_ORG
2120
Set Suite Variable $MINDER_TEST_ORG
2221

2322
Default Teardown
24-
Remove Provider Environment Variable for Test
2523
Remove Project Environment Variable for Test
2624

2725
*** Test Cases ***

minder-tests/api-profiles.robot

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ Test Teardown Default Teardown
2121

2222
*** Keywords ***
2323
Default Setup
24-
Set Provider as Environment Variable with Test Name
2524
Set Project as Environment Variable with Test Name
2625
Ruletypes are ready
2726
Ruletypes are created
2827

2928
Default Teardown
30-
Remove Provider Environment Variable for Test
3129
Remove Project Environment Variable for Test
3230

3331
*** Test Cases ***

minder-tests/api-repositories.robot

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ Test Teardown Default Teardown
2121

2222
*** Keywords ***
2323
Default Setup
24-
Set Provider as Environment Variable with Test Name
2524
Set Project as Environment Variable with Test Name
2625
${MINDER_TEST_ORG}= Get Environment Variable MINDER_TEST_ORG
2726
Set Suite Variable $MINDER_TEST_ORG
2827

2928
Default Teardown
30-
Remove Provider Environment Variable for Test
3129
Remove Project Environment Variable for Test
3230

3331
*** Test Cases ***

minder-tests/api-tests.robot

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ Library resources.minder_restapi_lib.MinderRestApiLib
1111
Library resources.eval_results_service.EvalResultsService
1212
Library resources.rule_type_service.RuleTypeService
1313

14-
Suite Setup Set Rest Base URL And Provider Environment Variables
15-
Suite Teardown Remove Provider Environment Variable
14+
Suite Setup Set Rest Base URL From Config
1615

1716
Test Setup Create Project And Ruletypes
1817
Test Teardown Delete Ruletypes And Project

resources/eval_history_service.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ def client_retrieves_eval_history(self):
3131
if not project:
3232
raise ConfigurationError("MINDER_PROJECT environment variable is not set")
3333

34-
provider = os.getenv("MINDER_PROVIDER")
35-
if not provider:
36-
raise ConfigurationError("MINDER_PROVIDER environment variable is not set")
37-
38-
params = {"provider": provider, "context.project": project}
34+
params = {"context.project": project}
3935

4036
try:
4137
rest_api = MinderRestApiLib()
@@ -111,11 +107,7 @@ def client_retrieves_non_empty_eval_history(self):
111107
if not project:
112108
raise ConfigurationError("MINDER_PROJECT environment variable is not set")
113109

114-
provider = os.getenv("MINDER_PROVIDER")
115-
if not provider:
116-
raise ConfigurationError("MINDER_PROVIDER environment variable is not set")
117-
118-
params = {"provider": provider, "context.project": project}
110+
params = {"context.project": project}
119111

120112
try:
121113
rest_api = MinderRestApiLib()
@@ -168,11 +160,7 @@ def client_retrieves_eval_history_by_id(self, history_id):
168160
if not project:
169161
raise ConfigurationError("MINDER_PROJECT environment variable is not set")
170162

171-
provider = os.getenv("MINDER_PROVIDER")
172-
if not provider:
173-
raise ConfigurationError("MINDER_PROVIDER environment variable is not set")
174-
175-
params = {"provider": provider, "context.project": project}
163+
params = {"context.project": project}
176164

177165
try:
178166
rest_api = MinderRestApiLib()

resources/eval_results_service.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ def client_retrieves_eval_results(self):
2525
if not project:
2626
raise ConfigurationError("MINDER_PROJECT environment variable is not set")
2727

28-
provider = os.getenv("MINDER_PROVIDER")
29-
if not provider:
30-
raise ConfigurationError("MINDER_PROVIDER environment variable is not set")
31-
32-
params = {"provider": provider, "context.project": project}
28+
params = {"context.project": project}
3329

3430
try:
3531
rest_api = MinderRestApiLib()

resources/github.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ def create_pr(self, repo_name, pr_title):
5757
repo_name,
5858
)
5959
)
60+
61+
@keyword
62+
def clone_ruletypes_from_github(self, path):
63+
"""Clone the ruletypes repository from GitHub to the specified folder."""
64+
logger.info(gh.repo.clone("mindersec/minder-rules-and-profiles", self.path))

resources/keywords.robot

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,24 @@ Library BuiltIn
1212
Library RequestsLibrary
1313

1414
*** Keywords ***
15-
Set Rest Base URL And Provider Environment Variables
16-
Set Rest Base URL From Config
17-
Set Provider as Environment Variable With Test Name
18-
19-
Remove Provider Environment Variable
20-
Remove Provider Environment Variable For Test
21-
2215
Set Rest Base URL From Config
2316
[Documentation] Reads the BASE_URL from the config file and sets it for all tests.
2417
${BASE_URL}= Get Rest URL From Config
2518
Set Suite Variable ${BASE_URL}
2619

27-
Set Provider As Environment Variable With Test Name
28-
[Documentation] Set the MINDER_PROVIDER environment variable to the first github-app provider
29-
30-
# We might want to make this more dynamic in the future, but for now this is good enough
31-
${GITHUB_APP_PROVIDER}= Get Github App Provider ID
32-
Set Environment Variable MINDER_PROVIDER ${GITHUB_APP_PROVIDER}
33-
34-
Remove Provider Environment Variable For Test
35-
[Documentation] Remove the provider environment variable after the test.
36-
Remove Environment Variable MINDER_PROVIDER
37-
3820
Create Ruletypes
3921
[Documentation] Create the ruletypes for the current project.
4022
4123
Given I Am Logged Into Minder
4224
Given Ruletypes Are Ready
4325
When Ruletypes Are Created
44-
Then Installed Ruletypes Are Listed
4526

4627
Delete Ruletypes
4728
[Documentation] Delete the ruletypes for the current project.
4829
4930
Given I Am Logged Into Minder
5031
Given Ruletypes Are Ready
5132
When All Ruletypes Are Deleted
52-
Then Installed Ruletypes Are Listed
5333

5434
Set Project as Environment Variable With Test Name
5535
[Documentation] Set the environment variable for the current test and log the test name.

resources/repositories_service.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,7 @@ def client_lists_repositories(self):
2626
if not project:
2727
raise ConfigurationError("MINDER_PROJECT environment variable is not set")
2828

29-
provider = os.getenv("MINDER_PROVIDER")
30-
if not provider:
31-
raise ConfigurationError("MINDER_PROVIDER environment variable is not set")
32-
33-
params = {
34-
# "provider": provider,
35-
"context.project": project
36-
}
29+
params = {"context.project": project}
3730

3831
try:
3932
self.results = self.rest_api.get_request("/repositories", params=params)

resources/ruletypes.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ def all_ruletypes_are_deleted(self):
4141
"""
4242
logger.info(minder.ruletype.delete("--all", "--yes"))
4343

44-
@keyword
45-
def installed_ruletypes_are_listed(self):
46-
"""
47-
List the ruletypes from minder.
48-
"""
49-
logger.info(minder.ruletype.list())
50-
5144
def _clone_ruletypes_from_github(self):
5245
"""
5346
Clone the ruletypes repository from GitHub.

0 commit comments

Comments
 (0)