def testPoliciesIsNotSupported(self):
   tw = template_writer.TemplateWriter(None, None)
   self.assertFalse(tw.IsPolicySupported({'future': True}))
   self.assertFalse(tw.IsPolicySupported({'deprecated': True}))
   self.assertFalse(tw.IsPolicySupported({'features': {'cloud_only': True}}))
   self.assertFalse(tw.IsPolicySupported({'features': {
       'internal_only': True
   }}))
 def testGetExpandedPolicyDescriptionForUrlSchema(self):
   policy = {'type': 'integer', 'url_schema': 'https://example.com/details'}
   tw = template_writer.TemplateWriter(None, None)
   tw.messages = {
       'doc_schema_description_link': {
           'text': '''See $6'''
       },
   }
   expanded_description = tw.GetExpandedPolicyDescription(policy)
   self.assertEqual(expanded_description, 'See https://example.com/details')
 def testGetExpandedPolicyDescriptionForJSONPolicies(self):
   policy = {'name': 'PolicyName', 'type': 'dict'}
   tw = template_writer.TemplateWriter(None, None)
   tw.messages = {
       'doc_schema_description_link': {
           'text': '''See $6'''
       },
   }
   expanded_description = tw.GetExpandedPolicyDescription(policy)
   self.assertEqual(
       expanded_description,
       'See https://cloud.google.com/docs/chrome-enterprise/policies/?policy=PolicyName'
   )
 def testGetExpandedPolicyDescriptionForJSONPolicies(self):
     policy = {'name': 'PolicyName', 'type': 'dict'}
     tw = template_writer.TemplateWriter(None, None)
     tw.messages = {
         'doc_schema_description_link': {
             'text': '''See $6'''
         },
     }
     expanded_description = tw.GetExpandedPolicyDescription(policy)
     self.assertEqual(
         expanded_description,
         'See https://www.chromium.org/administrators/policy-list-3#PolicyName'
     )
 def testHasExpandedPolicyDescriptionForJSONPolicies(self):
   policy = {'name': 'PolicyName', 'type': 'dict'}
   tw = template_writer.TemplateWriter(None, None)
   self.assertTrue(tw.HasExpandedPolicyDescription(policy))
 def testHasExpandedPolicyDescriptionForUrlSchema(self):
   policy = {'url_schema': 'https://example.com/details', 'type': 'list'}
   tw = template_writer.TemplateWriter(None, None)
   self.assertTrue(tw.HasExpandedPolicyDescription(policy))
 def testSortingIgnoreGroups(self):
   tw = template_writer.TemplateWriter(None, None)
   sorted_list = tw.FlattenGroupsAndSortPolicies(POLICY_DEFS)
   self.assertEqual(sorted_list, IGNORE_GROUPS_SORTED_POLICY_DEFS)
 def testSortingGroupsFirst(self):
   tw = template_writer.TemplateWriter(None, None)
   sorted_list = tw.SortPoliciesGroupsFirst(POLICY_DEFS)
   self.assertEqual(sorted_list, GROUP_FIRST_SORTED_POLICY_DEFS)
 def testPoliciesIsNotSupported(self):
     tw = template_writer.TemplateWriter(None, None)
     self.assertFalse(tw.IsPolicySupported({'future': True}))
     self.assertFalse(tw.IsPolicySupported({'deprecated': True}))