コード例 #1
0
 def test_load_auth_system_opts(self):
     self.useFixture(fixtures.MonkeyPatch(
         "os.environ",
         {"OS_TENANT_NAME": "fake-project",
         "OS_USERNAME": "******"}))
     parser = argparse.ArgumentParser()
     auth.load_auth_system_opts(parser)
     options = parser.parse_args(
         ["--os-auth-url=fake-url", "--os_auth_system=fake-system"])
     self.assertEqual(options.os_tenant_name, "fake-project")
     self.assertEqual(options.os_username, "fake-username")
     self.assertEqual(options.os_auth_url, "fake-url")
     self.assertEqual(options.os_auth_system, "fake-system")
コード例 #2
0
 def test_load_auth_system_opts(self):
     self.useFixture(fixtures.MonkeyPatch(
         "os.environ",
         {"OS_TENANT_NAME": "fake-project",
          "OS_USERNAME": "******"}))
     parser = argparse.ArgumentParser()
     auth.load_auth_system_opts(parser)
     options = parser.parse_args(
         ["--os-auth-url=fake-url", "--os_auth_system=fake-system"])
     self.assertEqual(options.os_tenant_name, "fake-project")
     self.assertEqual(options.os_username, "fake-username")
     self.assertEqual(options.os_auth_url, "fake-url")
     self.assertEqual(options.os_auth_system, "fake-system")
コード例 #3
0
ファイル: test_auth.py プロジェクト: thomasem/oslo-incubator
    def test_discover_auth_system_options(self, mock_mgr_map):
        """Test that we can load the auth system options."""
        class FakePlugin(BaseFakePlugin):
            @classmethod
            def add_opts(cls, parser):
                parser.add_argument('--auth_system_opt',
                                    default=False,
                                    action='store_true',
                                    help="Fake option")

        mock_mgr_map.side_effect = (
            lambda func: func(MockEntrypoint("fake", FakePlugin)))

        parser = argparse.ArgumentParser()
        auth.discover_auth_systems()
        auth.load_auth_system_opts(parser)
        opts, _args = parser.parse_known_args(['--auth_system_opt'])

        self.assertTrue(opts.auth_system_opt)
コード例 #4
0
    def test_discover_auth_system_options(self, mock_mgr_map):
        """Test that we can load the auth system options."""
        class FakePlugin(BaseFakePlugin):
            @classmethod
            def add_opts(cls, parser):
                parser.add_argument('--auth_system_opt',
                                    default=False,
                                    action='store_true',
                                    help="Fake option")

        mock_mgr_map.side_effect = (
            lambda func: func(MockEntrypoint("fake", FakePlugin)))

        parser = argparse.ArgumentParser()
        auth.discover_auth_systems()
        auth.load_auth_system_opts(parser)
        opts, _args = parser.parse_known_args(['--auth_system_opt'])

        self.assertTrue(opts.auth_system_opt)