@@ -42,10 +42,8 @@ def __init__(self, *args, **kwargs):
4242 self .yaml_file = _resolve_resources_path (POLICY_SPEC_YAML )
4343
4444 def test_json_parsing (self ):
45- # data = json_parser.parse_file(self.json_file)
46- # print_data = parse_policy_spec(data)
47- # pprint(print_data)
48- pass
45+ ps = json_parser .parse_file (self .json_file )
46+ self ._assert_policy_spec (ps )
4947
5048 def test_json_serialization (self ):
5149 ps = PolicySpecification (policy = _get_policy_obj (), defaults = _get_defaults_obj ())
@@ -55,15 +53,33 @@ def test_yaml_11_parsing(self):
5553 pass
5654
5755 def test_yaml_12_parsing (self ):
58- # data = yaml_parser.parse_file(self.yaml_file)
59- # print_data = parse_policy_spec(data)
60- # pprint(print_data)
61- pass
56+ ps = yaml_parser .parse_file (self .yaml_file )
57+ self ._assert_policy_spec (ps )
6258
6359 def test_yaml_serialization (self ):
6460 ps = PolicySpecification (policy = _get_policy_obj (), defaults = _get_defaults_obj ())
6561 yaml_parser .serialize (ps , 'test_yaml_serialization.yaml' )
6662
63+ def _assert_policy_spec (self , ps ):
64+ """
65+
66+ :param vcert.policy.PolicySpecification ps:
67+ :return:
68+ """
69+ self .assertIsNotNone (ps )
70+ self .assertIn ("venafi.com" , ps .policy .domains )
71+ self .assertIn ("kwan.com" , ps .policy .domains )
72+ self .assertIn ("venafi.com" , ps .policy .subject .orgs )
73+ self .assertTrue (len (ps .policy .subject .orgs ) == 1 )
74+ self .assertIn ("DevOps" , ps .policy .subject .org_units )
75+ self .assertTrue (len (ps .policy .subject .org_units ) == 1 )
76+ self .assertIn ("Merida" , ps .policy .subject .localities )
77+ self .assertTrue (len (ps .policy .subject .localities ) == 1 )
78+ self .assertIn ("RSA" , ps .policy .key_pair .key_types )
79+ self .assertTrue (len (ps .policy .key_pair .key_types ) == 1 )
80+ self .assertIn (2048 , ps .policy .key_pair .rsa_key_sizes )
81+ self .assertTrue (len (ps .policy .key_pair .rsa_key_sizes ) == 1 )
82+
6783
6884class TestTPPPolicyManagement (unittest .TestCase ):
6985 def __init__ (self , * args , ** kwargs ):
0 commit comments