@@ -50,7 +50,6 @@ Available tasks:
50
50
function.
51
51
test.lint Linting with ` pylint` and ` autopep8`
52
52
test.security Runs ` bandit` and ` safety check`
53
- unit.nose Unit testing: Runs unit tests using ` nosetests`
54
53
unit.pytest Unit testing: Runs unit tests using ` pytest`
55
54
56
55
@@ -64,8 +63,6 @@ invoke integration.query
64
63
invoke integration.write-policy
65
64
66
65
invoke test.security
67
-
68
- invoke unit.nose
69
66
```
70
67
71
68
Local Unit Testing and Integration Testing:
@@ -95,89 +92,37 @@ just run that quick command on your machine.
95
92
Running the Test Suite
96
93
----------------------
97
94
98
- We use [ Nose ] ( https://nose.readthedocs.io /en/latest / ) for unit testing.
99
- All tests are placed in the ` tests ` folder.
95
+ We use [ pytest ] ( https://docs.pytest.org /en// ) for unit testing.
96
+ All tests are placed in the ` test ` folder.
100
97
101
98
- Just run the following:
102
99
103
100
``` bash
104
- nosetests -v
101
+ pytest -v
105
102
106
103
# This will output the print() statements in your test code
107
- nosetests -v --nocapture
104
+ pytest -v --show-capture=no
108
105
109
106
# This will include the debug logging statements in the test output
110
- nosetests -v --logging -level=DEBUG
107
+ pytest -v --log -level=DEBUG
111
108
```
112
109
113
110
- Alternatively, you can use ` invoke ` , as mentioned above:
114
111
115
112
``` bash
116
- invoke unit.nose
113
+ invoke unit.pytest
117
114
```
118
115
119
116
Output:
120
117
121
118
``` text
122
- test_overrides_yml_config: Tests the format of the overrides yml file for the RAM service ... ok
123
- test_passing_overall_iam_action_override: Tests iam:CreateAccessKey ... ok
124
- test_get_dependent_actions_double (test_actions.ActionsTestCase) ... ok
125
- test_get_dependent_actions_several (test_actions.ActionsTestCase) ... ok
126
- test_get_dependent_actions_single (test_actions.ActionsTestCase) ... ok
127
- test_analyze_by_access_level: Test out calling this as a library ... ok
128
- test_determine_risky_actions_from_list: Test comparing requested actions to a list of risky actions ... ok
129
- test_get_actions_from_policy: Verify that the get_actions_from_policy function is grabbing the actions ... ok
130
- test_get_actions_from_policy_file_with_explicit_actions: Verify that we can get a list of actions from a ... ok
131
- test_get_actions_from_policy_file_with_wildcards: Verify that we can read the actions from a file, ... ok
132
- test_remove_actions_not_matching_access_level: Verify remove_actions_not_matching_access_level is working as expected ... ok
133
- test_get_findings: Ensure that finding.get_findings() combines two risk findings for one policy properly. ... ok
134
- test_get_findings_by_policy_name: Testing out the 'Findings' object ... ok
135
- test_add_s3_permissions_management_arn (test_arn_action_group.ArnActionGroupTestCase) ... ok
136
- test_get_policy_elements (test_arn_action_group.ArnActionGroupTestCase) ... ok
137
- test_update_actions_for_raw_arn_format (test_arn_action_group.ArnActionGroupTestCase) ... ok
138
- test_does_arn_match_case_1 (test_arns.ArnsTestCase) ... ok
139
- test_does_arn_match_case_2 (test_arns.ArnsTestCase) ... ok
140
- test_does_arn_match_case_4 (test_arns.ArnsTestCase) ... ok
141
- test_does_arn_match_case_5 (test_arns.ArnsTestCase) ... ok
142
- test_does_arn_match_case_6 (test_arns.ArnsTestCase) ... ok
143
- test_does_arn_match_case_bucket (test_arns.ArnsTestCase) ... ok
144
- test_determine_actions_to_expand: provide expanded list of actions, like ecr:* ... ok
145
- test_minimize_statement_actions (test_minimize_wildcard_actions.MinimizeWildcardActionsTestCase) ... ok
146
- test_get_action_data: Tests function that gets details on a specific IAM Action. ... ok
147
- test_get_actions_at_access_level_that_support_wildcard_arns_only: Test function that gets a list of ... ok
148
- test_get_actions_for_service: Tests function that gets a list of actions per AWS service. ... ok
149
- test_get_actions_matching_condition_crud_and_arn: Get a list of IAM Actions matching condition key, ... ok
150
- test_get_actions_matching_condition_crud_and_wildcard_arn: Get a list of IAM Actions matching condition key ... ok
151
- test_get_actions_matching_condition_key: Tests a function that gathers all instances in ... ok
152
- test_get_actions_that_support_wildcard_arns_only: Tests function that shows all ... ok
153
- test_get_actions_with_access_level: Tests function that gets a list of actions in a ... ok
154
- test_get_actions_with_arn_type_and_access_level: Tests a function that gets a list of ... ok
155
- test_get_all_actions_with_access_level: Get all actions with a given access level ... ok
156
- test_get_arn_type_details: Tests function that grabs details about a specific ARN name ... ok
157
- test_get_arn_types_for_service: Tests function that grabs arn_type and raw_arn pairs ... ok
158
- test_get_condition_key_details: Tests function that grabs details about a specific condition key ... ok
159
- test_get_condition_keys_for_service: Tests function that grabs a list of condition keys per service. ... ok
160
- test_get_raw_arns_for_service: Tests function that grabs a list of raw ARNs per service ... ok
161
- test_remove_actions_that_are_not_wildcard_arn_only: Tests function that removes actions from a list that ... ok
162
- test_actions_template (test_template.TemplateTestCase) ... ok
163
- test_crud_template (test_template.TemplateTestCase) ... ok
164
- test_actions_schema: Validates that the user-supplied YAML is working for CRUD mode ... ok
165
- test_actions_schema: Validates that the user-supplied YAML is working for CRUD mode ... ok
166
- test_print_policy_with_actions_having_dependencies (test_write_policy.WritePolicyActionsTestCase) ... ok
167
- test_write_policy (test_write_policy.WritePolicyCrudTestCase) ... ok
168
- test_write_policy_beijing: Tests ARNs with the partiion `aws-cn` instead of just `aws` ... ok
169
- test_write_policy_govcloud: Tests ARNs with the partition `aws-us-gov` instead of `aws` ... ok
170
- test_wildcard_when_not_necessary: Attempts bypass of CRUD mode wildcard-only ... ok
171
- test_write_actions_policy_with_library_only: Write an actions mode policy without using the command line at all (library only) ... ok
172
- test_write_crud_policy_with_library_only: Write an actions mode policy without using the command line at all (library only) ... ok
173
- test_actions_missing_actions: write-policy actions if the actions block is missing ... ok
174
- test_allow_missing_access_level_categories_in_cfg: write-policy when the YAML file ... ok
175
- test_allow_empty_access_level_categories_in_cfg: If the content of a list is an empty string, it should sysexit ... ok
176
- test_actions_missing_arn: write-policy actions command when YAML file block is missing an ARN ... ok
177
- test_actions_missing_description: write-policy when the YAML file is missing a description ... ok
178
- test_actions_missing_name: write-policy when the YAML file is missing a name ... ok
179
-
180
- Ran 57 tests in 2.694s
181
-
182
- OK
119
+ test/analysis/test_analyze.py::AnalysisExpandWildcardActionsTestCase::test_a_determine_actions_to_expand_not_upper_camelcase PASSED [ 0%]
120
+ test/analysis/test_analyze.py::AnalysisExpandWildcardActionsTestCase::test_analyze_by_access_level PASSED [ 1%]
121
+ test/analysis/test_analyze.py::AnalysisExpandWildcardActionsTestCase::test_analyze_statement_by_access_level PASSED [ 2%]
122
+ test/analysis/test_analyze.py::AnalysisExpandWildcardActionsTestCase::test_determine_actions_to_expand PASSED [ 2%]
123
+ test/analysis/test_analyze.py::AnalysisExpandWildcardActionsTestCase::test_gh_162 PASSED [ 3%]
124
+ test/analysis/test_expand.py::PolicyExpansionTestCase::test_policy_expansion PASSED [ 4%]
125
+ ...
126
+
127
+ ========================================================= 134 passed in 51.04s ============================================================
183
128
```
0 commit comments