def test_adheres_to_verification_policies(args, verified_result,
                                              should_be_present):
        with register_plugin(MockPlugin(verified_result=verified_result),
                             ), mock_printer(main_module) as printer:
            main_module.main(['scan', '--string', 'fake-secret', *args])

        for line in printer.message.splitlines():
            plugin_name, result = [x.strip() for x in line.split(':')]
            if plugin_name != 'MockPlugin':
                continue

            assert should_be_present == result.startswith('True')
 def test_handles_request_error_gracefully():
     with register_plugin(ExceptionRaisingMockPlugin()):
         main_module.main(['scan', '--string', 'fake-secret'])
 def test_supports_injection_of_context():
     # NOTE: This test case relies on the fact that this file contains a multi-factor
     # AWS KeyPair.
     with register_plugin(ContextAwareMockPlugin()):
         main_module.main(['scan', 'test_data/each_secret.py'])
 def test_does_not_verify_if_no_verify():
     with register_plugin(MockPlugin(should_verify=False)):
         main_module.main(
             ['scan', '--string', 'fake-secret', '--no-verify'])