Skip to content

Commit 8533fc8

Browse files
committed
test: debug test failures
1 parent f300cfe commit 8533fc8

File tree

3 files changed

+38
-36
lines changed

3 files changed

+38
-36
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ before_install:
1717
- sudo apt-get install pandoc
1818
- pip install pypandoc
1919
- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_3058bc69cb40_key -iv $encrypted_3058bc69cb40_iv -in ghost.env.enc -out ghost.env -d || true'
20-
- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_66f264007c0d_key -iv $encrypted_66f264007c0d_iv -in iam_access_groups.env.enc -out iam_access_groups.env -d -d || true'
21-
- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_c15ed1ae2677_key -iv $encrypted_c15ed1ae2677_iv -in global_catalog.env.enc -out global_catalog.env -d || true'
20+
- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_94fa7fdf4df9_key -iv $encrypted_94fa7fdf4df9_iv -in global_catalog.env.enc -out global_catalog.env -d || true'
21+
- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_66f264007c0d_key -iv $encrypted_66f264007c0d_iv -in iam_access_groups.env.enc -out iam_access_groups.env -d || true'
2222

2323
install:
2424
- pip install tox-travis

global_catalog.env.enc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
�]a f���QQu�I��
2-
�|�{�R5���$Y34[�j�z��z�c�H�R��o)'}m9��'����N"Ѷ\�����%Std�#��o\`��s-"�\��}۾:��"wa�GH�Rc��4{ �p�� ���r���1{�)y���fjj����Oj�_tq4��C���vZ�-I7��tR�e��b���~H�ۢ��YNxw��p4�'����i����zT j�ׄ�_c>N��n
1+
�5Ł��x�8��'[�#��K��&��G�'�WƧy���l��}Gٺ� /u�!�̄P�3���Ӣ{�z���{W̎Md�yGt���{�N��=����i���!��������K�L7��)�,�/����k�17���V @gsG1���ĞʆV�S!S��;�-�#C�x�$�cy��$����!(�!���P?t�2���}���-�ۋ���}zO6p��, z�a�� �J|H�����

test/integration/test_global_catalog_v1.py

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,50 @@
1919

2020
import unittest
2121
import os
22-
from ibm_platform_services import GlobalCatalogV1
2322
from ibm_cloud_sdk_core import *
23+
from ibm_platform_services.global_catalog_v1 import *
24+
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
2425
import pytest
26+
from jproperties import Properties
27+
import time
2528

2629
configFile = 'global_catalog.env'
2730
configLoaded = None
31+
config = {}
2832

2933
if os.path.exists(configFile):
30-
os.environ['IBM_CREDENTIALS_FILE'] = 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+
3141
configLoaded = True
3242
else:
3343
print('External configuration was not found, skipping tests...')
3444

3545
class TestGlobalCatalogV1(unittest.TestCase):
3646

3747
@classmethod
38-
def setUpClass(cls):
48+
def setUpClass(self):
3949
if not configLoaded:
4050
raise unittest.SkipTest('External configuration not available, skipping...')
4151

42-
cls.service = GlobalCatalogV1.new_instance()
43-
assert cls.service is not None
44-
45-
cls.config = read_external_sources(GlobalCatalogV1.DEFAULT_SERVICE_NAME)
46-
assert cls.config is not None
47-
cls.authType = cls.config.get('AUTH_TYPE')
48-
cls.apkKey = cls.config.get('APIKEY')
49-
cls.authUrl = cls.config.get('AUTH_URL')
50-
cls.url = cls.config.get('URL')
51-
assert cls.authType is not None
52-
print(cls.authType)
53-
assert cls.apkKey is not None
54-
assert cls.authUrl is not None
55-
print(cls.authUrl)
56-
assert cls.url is not None
57-
print(cls.url)
58-
59-
cls.defaultEntry = {
60-
'name': 'someName',
61-
'id': 'someId',
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+
authenticator = IAMAuthenticator(apiKey, url=iamUrl)
57+
58+
self.service = GlobalCatalogV1(authenticator=authenticator)
59+
self.service.set_service_url(config['GLOBAL_CATALOG_URL'])
60+
61+
timestamp = int(time.time())
62+
63+
self.defaultEntry = {
64+
'name': 'someName{}'.format(timestamp),
65+
'id': 'someId{}'.format(timestamp),
6266
'active': False,
6367
'kind': 'service',
6468
'disabled': False,
@@ -92,10 +96,10 @@ def setUpClass(cls):
9296
}
9397
}
9498

95-
cls.defaultChildEntry = {
99+
self.defaultChildEntry = {
96100
'name': 'someChildName',
97101
'id': 'someChildId',
98-
'parent_id': cls.defaultEntry['id'],
102+
'parent_id': self.defaultEntry['id'],
99103
'active': False,
100104
'kind': 'service',
101105
'disabled': False,
@@ -119,9 +123,9 @@ def setUpClass(cls):
119123
}
120124
}
121125

122-
cls.updatedEntry = {
123-
'name': 'someNameUpdated',
124-
'id': 'someId',
126+
self.updatedEntry = {
127+
'name': 'someNameUpdated{}'.format(timestamp),
128+
'id': 'someId{}'.format(timestamp),
125129
'active': False,
126130
'kind': 'template',
127131
'disabled': False,
@@ -145,12 +149,11 @@ def setUpClass(cls):
145149
}
146150
}
147151

148-
def setup(self):
152+
def setUp(self):
149153
self.service.delete_catalog_entry(id=self.defaultEntry['id'])
150154

151-
@classmethod
152-
def tearDown(cls):
153-
cls.service.delete_catalog_entry(id=cls.defaultEntry['id'])
155+
def tearDown(self):
156+
self.service.delete_catalog_entry(id=self.defaultEntry['id'])
154157

155158
def test_create_catalog_entry(self):
156159
env = self.service.create_catalog_entry(id=self.defaultEntry['id'],

0 commit comments

Comments
 (0)