def test_has_scan_configurations(self):
     config = ZapConfiguration("./tests/mocks/context-with-overlay/")
     self.assertTrue(config.get_contexts.has_configurations)
     self.assertFalse(config.get_scanners.has_configurations)
 
     config = ZapConfiguration("./tests/mocks/scan-full-bodgeit-docker/")
     self.assertTrue(config.get_contexts.has_configurations)
     self.assertTrue(config.get_scanners.has_configurations)
    def test_has_scan_configurations(self):
        config = ZapConfiguration("./tests/mocks/context-with-overlay/",
                                  "https://www.secureCodeBox.io/")
        self.assertIsNotNone(config.get_active_context_config)
        self.assertIsNone(config.get_active_spider_config)

        config = ZapConfiguration("./tests/mocks/scan-full-bodgeit-docker/",
                                  "http://bodgeit:8080/bodgeit/")
        self.assertIsNotNone(config.get_active_context_config)
        self.assertIsNotNone(config.get_active_spider_config)
    def test_has_scan_configurations(self):
        config = ZapConfiguration(
            "./tests/mocks/context-using-forced-context/",
            "http://test.example.com",
            forced_context="scb-test-context")
        self.assertIsNotNone(config.get_active_context_config)
        self.assertEqual("scb-test-context",
                         config.get_active_context_config["name"])

        self.assertIsNotNone(config.get_active_spider_config)
        self.assertEqual("scb-test-spider",
                         config.get_active_spider_config["name"])

        self.assertIsNotNone(config.get_active_scanner_config)
        self.assertEqual("scb-test-scanner",
                         config.get_active_scanner_config["name"])
 def test_returns_the_current_context_correctly(self):
     config = ZapConfiguration("./tests/mocks/context-with-overlay/",
                               "https://www.secureCodeBox.io/")
     context = config.get_active_context_config
     self.assertIsNotNone(context)
     self.assertEqual(context["name"], "secureCodeBoxScanType-NoAuth")
 def test_config_context_with_overlay(self):
     config = ZapConfiguration("./tests/mocks/context-with-overlay/",
                               "https://www.secureCodeBox.io/")
     self.assertIsNotNone(config.get_active_context_config)
 def test_empty_config_file(self):
     config = ZapConfiguration("./tests/mocks/empty-files/",
                               "https://www.secureCodeBox.io/")
     self.assertIsNone(config.get_active_context_config)
 def test_corrupt_config_path(self):
     config = ZapConfiguration("not/existing/path", "https://example.com")
     self.assertIsNone(config.get_active_context_config)
 def test_empty_config_path(self):
     config = ZapConfiguration("", "https://example.com")
     self.assertIsNone(config.get_active_context_config)
 def test_config_context_with_overlay(self):
     config = ZapConfiguration("./tests/mocks/context-with-overlay/")
     self.assertTrue(config.get_contexts.has_configurations)
 def test_empty_config_file(self):
     config = ZapConfiguration("./tests/mocks/empty-files/")
     self.assertFalse(config.get_contexts.has_configurations)
 def test_corrupt_config_path(self):
     config = ZapConfiguration("not/existing/path")
     self.assertFalse(config.get_contexts.has_configurations)
 def test_empty_config_path(self):
     config = ZapConfiguration("")
     self.assertFalse(config.get_contexts.has_configurations)