예제 #1
0
 def test_scan_scan_dirs_invalid(self):
     """Test utilizing the scan command exercising the
     scan-dirs flag to scope a scan using a invalid path values
     """
     with self.assertRaises(SystemExit):
         sys.argv = ['/bin/rho', "scan", "--profile", "profilename",
                     "--reportfile", TMP_TEST_REPORT, "--scan-dirs",
                     'rm -fr /foobar', "--vault", TMP_VAULT_PASS]
         ScanCommand().main()
예제 #2
0
 def test_scan_scan_dirs_file(self):
     """Test utilizing the scan command exercising the
     scan-dirs flag to scope a scan using a file for input
     """
     with self.assertRaises(SystemExit):
         sys.argv = ['/bin/rho', "scan", "--profile", "profilename",
                     "--reportfile", TMP_TEST_REPORT, "--scan-dirs",
                     TMP_FACTS, "--vault", TMP_VAULT_PASS]
         ScanCommand().main()
예제 #3
0
    def test_scan_facts_no_reportfile(self):
        """Test utilizing the scan command catch no report file error
        """

        with self.assertRaises(SystemExit):
            sys.argv = ['/bin/rho', "scan", "--profile", "profilename",
                        "--facts", "default", "--ansible-forks",
                        "100", "--vault", TMP_VAULT_PASS]
            with redirect_credentials([]):
                ScanCommand().main()
예제 #4
0
    def test_scan_facts_neg_int_forks(self):
        """Test utilizing the scan command catch bad input for forks error
        """

        with self.assertRaises(SystemExit):
            sys.argv = [
                '/bin/rho', "scan", "--profile", "profilename", "--reset",
                "--reportfile", TMP_TEST_REPORT, "--facts", "default",
                "ansible_forks", "-4", "--vault", TMP_VAULT_PASS
            ]
            ScanCommand().main()
예제 #5
0
    def test_scan_facts_invalid_list(self):
        """Test utilizing the scan command exercising the collection
        the facts from an invalid facts list with 100 ansible forks
        """

        with self.assertRaises(SystemExit):
            sys.argv = ['/bin/rho', "scan", "--profile", "profilename",
                        "--reportfile",
                        TMP_TEST_REPORT, "--facts",
                        "bad.fact1", "bad.fact2", "--ansible-forks",
                        "100", "--vault", TMP_VAULT_PASS]
            ScanCommand().main()
예제 #6
0
    def test_scan_facts_file(self):
        """Test utilizing the scan command exercising the collection
        the facts from an input facts file with 100 ansible forks
        """

        with self.assertRaises(SystemExit):
            sys.argv = [
                '/bin/rho', "scan", "--profile", "profilename", "--reset",
                "--reportfile", TMP_TEST_REPORT, "--facts", TMP_FACTS,
                "ansible_forks", "100", "--vault", TMP_VAULT_PASS
            ]
            ScanCommand().main()
예제 #7
0
    def test_scan_facts_jboss(self):
        """Test utilizing the scan command exercising the collection
        the jboss facts with 100 ansible forks
        """

        with self.assertRaises(SystemExit):
            sys.argv = ['/bin/rho', "scan", "--profile", "profilename",
                        "--reportfile",
                        TMP_TEST_REPORT, "--facts",
                        "jboss", "--ansible-forks",
                        "100", "--vault", TMP_VAULT_PASS]
            with redirect_credentials([]):
                ScanCommand().main()