Skip to content

Commit 5c4a948

Browse files
committed
Update test_vault_vault.py
1 parent 3c22785 commit 5c4a948

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

tests/unitary/with_extras/vault/test_vault_vault.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22

33
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
5-
6-
from ads.vault.vault import Vault
5+
import base64
6+
import json
7+
import os
78
from collections import namedtuple
89
from datetime import datetime, timezone
10+
from importlib import reload
11+
from unittest.mock import MagicMock
12+
913
from oci.secrets.models import SecretBundle, Base64SecretBundleContentDetails
1014
from oci.vault.models import Secret
11-
from unittest.mock import MagicMock
12-
import base64
13-
import json
15+
16+
import ads.config
17+
from ads.vault.vault import Vault
1418

1519

1620
class TestVault:
@@ -38,6 +42,16 @@ class TestVault:
3842
secret_ocid = "ocid1.vaultsecret.oc1.iad.<unique_id>"
3943
date_time = datetime(2021, 7, 13, 18, 24, 42, 110000, tzinfo=timezone.utc)
4044

45+
def setup_method(self):
46+
os.environ[
47+
"NB_SESSION_COMPARTMENT_OCID"
48+
] = "ocid1.compartment.oc1.<unique_ocid>"
49+
reload(ads.config)
50+
51+
def teardown_method(self):
52+
os.environ.pop("NB_SESSION_COMPARTMENT_OCID", None)
53+
reload(ads.config)
54+
4155
def test_create_secret(self):
4256
"""Test vault.create_secret()."""
4357
wrapper = namedtuple("wrapper", ["data"])

0 commit comments

Comments
 (0)