def test_discover_auth_system_options(self, mock_iter_entry_points): """Test that we can load the auth system options.""" class FakePlugin(auth_plugin.BaseAuthPlugin): @staticmethod def add_opts(parser): parser.add_argument('--auth_system_opt', default=False, action='store_true', help="Fake option") return parser class MockEntrypoint(pkg_resources.EntryPoint): def load(self): return FakePlugin mock_iter_entry_points.side_effect = lambda _t: [ MockEntrypoint("fake", "fake", ["FakePlugin"]) ] parser = argparse.ArgumentParser() auth_plugin.discover_auth_systems() auth_plugin.load_auth_system_opts(parser) opts, args = parser.parse_known_args(['--auth_system_opt']) self.assertTrue(opts.auth_system_opt)
def test_discover_auth_system_options(self, mock_iter_entry_points): """Test that we can load the auth system options.""" class FakePlugin(auth_plugin.BaseAuthPlugin): @staticmethod def add_opts(parser): parser.add_argument("--auth_system_opt", default=False, action="store_true", help="Fake option") return parser class MockEntrypoint(pkg_resources.EntryPoint): def load(self): return FakePlugin mock_iter_entry_points.side_effect = lambda _t: [MockEntrypoint("fake", "fake", ["FakePlugin"])] parser = argparse.ArgumentParser() auth_plugin.discover_auth_systems() auth_plugin.load_auth_system_opts(parser) opts, args = parser.parse_known_args(["--auth_system_opt"]) self.assertTrue(opts.auth_system_opt)