You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contributing/testing.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,14 +76,14 @@ Local Unit Testing and Integration Testing:
76
76
77
77
* File mapping: Unit test files map directly to the .py files in the Policy Sentry package
78
78
* Folder mapping: Folder structure of the test files maps directly to the folder structure in the Policy Sentry package
79
-
* GitHub issue mapping: Add unit tests that correspond directly to those GitHub issues to show that the fix work specifically for the issue raised. prefix test name with issue number.
79
+
* GitHub issue mapping: Add unit tests that correspond directly to those GitHub issues to show that the fix work specifically for the issue raised. prefix test name with issue number.
80
80
For example: [test_gh_211_write_with_empty_access_level_lists](https://github.com/salesforce/policy_sentry/blob/0b3398a365f4cf0901bd779c6156207688e7858b/test/writing/test_write_policy_library_usage.py#L269) is prefixed with issue number 111.
81
-
* Adaptable to IAM Definition changes:
81
+
* Adaptable to IAM Definition changes:
82
82
* For tests that are dependent on current state of the IAM definition (aka the IAM Database, iam_definition.json), avoid doing equals comparision of the results with the expected_results.
83
83
* Over time, as IAM definiton changes, chances are that such tests would fail.
84
84
* Example: let's say that hypothetically the secretsmanager service had 4 actions at the "write" access level that could be restricted to the secret resource type. If I wrote the tests so that they tested the value of the generated policy, that works for the initial tests. But if AWS adds two new actions that can be restricted to that access level and resource type, then the tests would fail.
85
85
* This only really applies for where the expected test values would be dependent on the current state of the IAM definition (aka the IAM Database, iam_definition.json) and the actions in there. So, validating the output of write-policy related commands, and query related commands.
86
-
* After I realized that, I started writing my tests so that the expected output that showed what actions you'd want would be in the comments instead of the expected_results, so the human knows what's going on. And then I would just check that the size of the array holding the actions is greater than or equal to the size that it is currently at.
86
+
* After I realized that, I started writing my tests so that the expected output that showed what actions you'd want would be in the comments instead of the expected_results, so the human knows what's going on. And then I would just check that the size of the array holding the actions is greater than or equal to the size that it is currently at.
87
87
So, in the secretsmanager example above, the test would probably just check that the size of the actions is greater than or equal to 4.
88
88
89
89
@@ -101,8 +101,7 @@ folder.
101
101
./utils/run_tests.sh
102
102
```
103
103
104
-
It will execute all of the tests that would normally be run during the
105
-
TravisCI build. If you want to see if it will pass TravisCI, you can
104
+
It will execute all of the tests that would normally be run during the build. If you want to see if it will pass GitHub actions, you can
0 commit comments