def test_list_items_in_repo_no_key(self): "Test graceful failure of a list of items for a item_type that is not listed in opencontrol.yaml file" ocf = OpenControlFiles() repo_ref = 'https://github.com/18F/cg-compliance' revision = 'master' component_path = '' item_type = "standards" ocfileurl = ocf.resolve_ocfile_url(repo_ref, revision) # load opencontrol.yaml file items = ocf.list_items_in_repo(ocfileurl, item_type) self.assertTrue([] == items)
def test_list_items_in_repo(self): "Test generating a list of components from opencontrol.yaml file" ocf = OpenControlFiles() repo_ref = 'https://github.com/18F/cg-compliance' revision = 'master' component_path = '' item_type = "components" ocfileurl = ocf.resolve_ocfile_url(repo_ref, revision) # load opencontrol.yaml file components = ocf.list_items_in_repo(ocfileurl, item_type) self.assertTrue(['./AC_Policy', './AT_Policy', './AU_Policy', './CA_Policy', './CICloudGov', './CM_Policy', './CP_Policy', './CloudCheckr', './ELKStack', './IA_Policy', './IR_Policy', './JumpBox', './MA_Policy', './MP_Policy', './PE_Policy', './PL_Policy', './PS_Policy', './RA_Policy', './SA_Policy', './SC_Policy', './SI_Policy', './SecureProxy'] == components)
def test_list_standards_in_repo(self): "Test listing of standards from opencontrol.yaml file" ocf = OpenControlFiles() # test with repo on localfile system with local and remote certifications references print("\n******* test repo on localfile system ****") revision = 'master' item_type = "standards" # construct absolute file path dir_path = os.path.dirname(os.path.realpath(__file__)) repo_ref = "file://{}/{}".format(dir_path, "test_data/repo2") # resolve the `opencontrol.yaml` file ocfileurl = ocf.resolve_ocfile_url(repo_ref, revision) items = ocf.list_items_in_repo(ocfileurl, item_type) print("ocf.list_items_in_repo: ", items) self.assertTrue(['./standards/FRIST-800-53.yaml'] == items)
def test_list_certifications_in_repo(self): "Test generating a list of certifications from opencontrol.yaml file" ocf = OpenControlFiles() # test with repo on localfile system with local and remote certifications references print("\n******* test repo on localfile system ****") revision = 'master' item_type = "certifications" # construct absolute file path dir_path = os.path.dirname(os.path.realpath(__file__)) repo_ref = "file://{}/{}".format(dir_path, "test_data/repo2") # resolve the `opencontrol.yaml` file ocfileurl = ocf.resolve_ocfile_url(repo_ref, revision) items = ocf.list_items_in_repo(ocfileurl, item_type) print("ocf.list_items_in_repo: ", items) self.assertTrue('./certifications/FredRAMP-low.yaml' in items) self.assertTrue('./certifications/LATO.yaml' in items)
def test_list_items_in_repo(self): "Test generating a list of components from opencontrol.yaml file" ocf = OpenControlFiles() repo_ref = 'https://github.com/18F/cg-compliance' revision = 'master' component_path = '' item_type = "components" ocfileurl = ocf.resolve_ocfile_url(repo_ref, revision) # load opencontrol.yaml file components = ocf.list_items_in_repo(ocfileurl, item_type) self.assertTrue([ './AC_Policy', './AT_Policy', './AU_Policy', './CA_Policy', './CICloudGov', './CM_Policy', './CP_Policy', './CloudCheckr', './ELKStack', './IA_Policy', './IR_Policy', './JumpBox', './MA_Policy', './MP_Policy', './PE_Policy', './PL_Policy', './PS_Policy', './RA_Policy', './SA_Policy', './SC_Policy', './SI_Policy', './SecureProxy' ] == components)