File tree Expand file tree Collapse file tree 3 files changed +76
-7
lines changed Expand file tree Collapse file tree 3 files changed +76
-7
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,40 @@ strict = true
4
4
pretty = true
5
5
6
6
exclude = [
7
- ' ^policy_sentry/analysis' ,
8
7
' ^policy_sentry/bin' ,
9
8
' ^policy_sentry/command' ,
10
- ' ^policy_sentry/querying' ,
11
9
' ^policy_sentry/writing' ,
12
10
]
11
+
12
+ [tool .pytest .ini_options ]
13
+ testpaths = [
14
+ " test" ,
15
+ " test/analysis" ,
16
+ " test/command" ,
17
+ " test/querying" ,
18
+ " test/util" ,
19
+ " test/writing" ,
20
+ ]
21
+ norecursedirs = [
22
+ " _build" ,
23
+ " tmp*" ,
24
+ " __pycache__" ,
25
+ ]
26
+
27
+ # supported from version 7.3.0
28
+ # [tool.coverage]
29
+ # omit = [
30
+ # "policy_sentry/shared/awsdocs.py",
31
+ # # ignore v1 variants
32
+ # "policy_sentry/querying/actions_v1.py",
33
+ # "policy_sentry/querying/all_v1.py",
34
+ # "policy_sentry/querying/arns_v1.py",
35
+ # # omit anything in a .local directory anywhere
36
+ # "*/.local/*",
37
+ # "*/virtualenv/*",
38
+ # "*/venv/*",
39
+ # "*/.venv/*",
40
+ # "*/docs/*",
41
+ # "*/examples/*",
42
+ # "utils/*",
43
+ # ]
Original file line number Diff line number Diff line change 1
- [tool:pytest]
2
- testpaths = test test/analysis test/command test/querying test/util test/writing
3
- python_files =test/*/test_*.py
4
- norecursedirs = .svn _build tmp* __pycache__
5
-
6
1
# Exclude: __pycache__ / .pyc
7
2
[coverage:run]
8
3
; include =
@@ -11,6 +6,10 @@ norecursedirs = .svn _build tmp* __pycache__
11
6
; source=policy_sentry/*
12
7
omit =
13
8
policy_sentry/shared/awsdocs.py
9
+ # ignore v1 variants
10
+ policy_sentry/querying/actions_v1.py
11
+ policy_sentry/querying/all_v1.py
12
+ policy_sentry/querying/arns_v1.py
14
13
# omit anything in a .local directory anywhere
15
14
*/.local/*
16
15
*/virtualenv/*
Original file line number Diff line number Diff line change
1
+ from policy_sentry .util .actions import (
2
+ get_service_from_action ,
3
+ get_action_name_from_action ,
4
+ get_full_action_name ,
5
+ )
6
+
7
+
8
+ def test_get_service_from_action ():
9
+ # given
10
+ action = "ec2:DescribeInstance"
11
+
12
+ # when
13
+ service = get_service_from_action (action = action )
14
+
15
+ # then
16
+ assert service == "ec2"
17
+
18
+
19
+ def test_get_action_name_from_action ():
20
+ # given
21
+ action = "ec2:DescribeInstance"
22
+
23
+ # when
24
+ service = get_action_name_from_action (action = action )
25
+
26
+ # then
27
+ assert service == "describeinstance"
28
+
29
+
30
+ def test_get_full_action_name ():
31
+ # given
32
+ service = "ec2"
33
+ action_name = "DescribeInstance"
34
+
35
+ # when
36
+ action = get_full_action_name (service = service , action_name = action_name )
37
+
38
+ # then
39
+ assert action == "ec2:DescribeInstance"
You can’t perform that action at this time.
0 commit comments