コード例 #1
0
ファイル: configs_test.py プロジェクト: TACC/agavepy
    def test_load_configs(self, mock_get_tenants):
        """ Test load_configs function
        """
        try:
            # create a tmp dir and use it as a cache dir.
            cache_dir = tempfile.mkdtemp()
            # Save sample configurations to cache dir.
            with open("{}/config.json".format(cache_dir), "w") as f:
                json.dump(sample_config, f, indent=4)

            ag = Agave()
            ag.load_configs(cache_dir=cache_dir)

            sample_client = list(sample_config["current"].keys())[0]
            assert ag.client_name == sample_client
            assert ag.tenant_id   == sample_config["current"][sample_client]["tenantid"]
            assert ag.username    == sample_config["current"][sample_client]["username"]

        finally:
            shutil.rmtree(cache_dir)
コード例 #2
0
    def test_load_configs(self, mock_get_tenants):
        """ Test load_configs function
        """
        try:
            # create a tmp dir and use it as a cache dir.
            cache_dir = tempfile.mkdtemp()
            # Save sample configurations to cache dir.
            with open("{}/config.json".format(cache_dir), "w") as f:
                json.dump(sample_config, f, indent=4)

            ag = Agave()
            ag.load_configs(cache_dir=cache_dir)

            sample_client = list(sample_config["current"].keys())[0]
            assert ag.client_name == sample_client
            assert ag.tenant_id == sample_config["current"][sample_client][
                "tenantid"]
            assert ag.username == sample_config["current"][sample_client][
                "username"]

        finally:
            shutil.rmtree(cache_dir)
コード例 #3
0
ファイル: configs_test.py プロジェクト: TACC/agavepy
    def test_load_configs_specify_session(self, mock_get_tenants):
        """ Test load_configs function

        Load a specific session from a configurations file.
        """
        try:
            # create a tmp dir and use it as a cache dir.
            cache_dir = tempfile.mkdtemp()
            # Save sample configurations to cache dir.
            with open("{}/config.json".format(cache_dir), "w") as f:
                json.dump(sample_config, f, indent=4)

            ag = Agave()
            ag.load_configs(cache_dir=cache_dir, tenant_id="tacc.prod", 
                    username="******", client_name="client-2")

            assert ag.client_name == "client-2"
            assert ag.username    == "user-2"
            assert ag.tenant_id   == "tacc.prod"

        finally:
            shutil.rmtree(cache_dir)
コード例 #4
0
    def test_load_configs_specify_session(self, mock_get_tenants):
        """ Test load_configs function

        Load a specific session from a configurations file.
        """
        try:
            # create a tmp dir and use it as a cache dir.
            cache_dir = tempfile.mkdtemp()
            # Save sample configurations to cache dir.
            with open("{}/config.json".format(cache_dir), "w") as f:
                json.dump(sample_config, f, indent=4)

            ag = Agave()
            ag.load_configs(cache_dir=cache_dir,
                            tenant_id="tacc.prod",
                            username="******",
                            client_name="client-2")

            assert ag.client_name == "client-2"
            assert ag.username == "user-2"
            assert ag.tenant_id == "tacc.prod"

        finally:
            shutil.rmtree(cache_dir)