23
23
from ibm_platform_services .global_catalog_v1 import *
24
24
from ibm_cloud_sdk_core .authenticators import IAMAuthenticator
25
25
import pytest
26
- from jproperties import Properties
26
+ from dotenv import load_dotenv
27
27
import time
28
28
29
29
configFile = 'global_catalog.env'
30
30
configLoaded = None
31
31
config = {}
32
32
33
33
if os .path .exists (configFile ):
34
- with open (configFile , "rb" ) as f :
35
- p = Properties ()
36
- p .load (f , "utf-8" )
37
- config ['GLOBAL_CATALOG_APIKEY' ] = p ['GLOBAL_CATALOG_APIKEY' ].data
38
- config ['GLOBAL_CATALOG_AUTH_URL' ] = p ['GLOBAL_CATALOG_AUTH_URL' ].data
39
- config ['GLOBAL_CATALOG_URL' ] = p ['GLOBAL_CATALOG_URL' ].data
40
-
34
+ load_dotenv (dotenv_path = configFile )
41
35
configLoaded = True
42
36
else :
43
37
print ('External configuration was not found, skipping tests...' )
38
+ configLoaded = True
44
39
45
40
class TestGlobalCatalogV1 (unittest .TestCase ):
46
41
@@ -49,16 +44,9 @@ def setUpClass(self):
49
44
if not configLoaded :
50
45
raise unittest .SkipTest ('External configuration not available, skipping...' )
51
46
52
- apiKey = config ['GLOBAL_CATALOG_APIKEY' ]
53
- iamUrl = config ['GLOBAL_CATALOG_AUTH_URL' ]
54
- assert apiKey is not None
55
- assert iamUrl is not None
56
-
57
- authenticator = IAMAuthenticator (apiKey , url = iamUrl )
58
47
timestamp = int (time .time ())
59
48
60
- self .service = GlobalCatalogV1 (authenticator = authenticator )
61
- self .service .set_service_url (config ['GLOBAL_CATALOG_URL' ])
49
+ self .service = GlobalCatalogV1 .new_instance ()
62
50
63
51
self .defaultEntry = {
64
52
'name' : 'someName{}' .format (timestamp ),
0 commit comments