Skip to content

Commit 667f111

Browse files
committed
fix: Update config attribute names to match pipeline generation
- Change config.APIKEY -> config.API_KEY - Change config.DELIVERYTOKEN -> config.DELIVERY_TOKEN - Fixes AttributeError in existing test files
1 parent cbfdd9d commit 667f111

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

tests/test_assets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
ASSET_UID = ''
99
IMAGE = 'images_(1).jpg'
10-
API_KEY = config.APIKEY
11-
DELIVERY_TOKEN = config.DELIVERYTOKEN
10+
API_KEY = config.API_KEY
11+
DELIVERY_TOKEN = config.DELIVERY_TOKEN
1212
ENVIRONMENT = config.ENVIRONMENT
1313
HOST = config.HOST
1414

tests/test_entry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import config
44
import contentstack
55

6-
API_KEY = config.APIKEY
7-
DELIVERY_TOKEN = config.DELIVERYTOKEN
6+
API_KEY = config.API_KEY
7+
DELIVERY_TOKEN = config.DELIVERY_TOKEN
88
ENVIRONMENT = config.ENVIRONMENT
99
HOST = config.HOST
1010
FAQ_UID = config.FAQ_UID # Add this in your config.py

tests/test_live_preview.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
'host': 'rest-preview.contentstack.com'
3333
}
3434

35-
API_KEY = config.APIKEY
36-
DELIVERY_TOKEN = config.DELIVERYTOKEN
35+
API_KEY = config.API_KEY
36+
DELIVERY_TOKEN = config.DELIVERY_TOKEN
3737
ENVIRONMENT = config.ENVIRONMENT
3838
HOST = config.HOST
39-
ENTRY_UID = config.APIKEY
39+
ENTRY_UID = config.API_KEY
4040

4141
class TestLivePreviewConfig(unittest.TestCase):
4242

tests/test_query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from contentstack.basequery import QueryOperation
66
from contentstack.query import QueryType
77

8-
API_KEY = config.APIKEY
9-
DELIVERY_TOKEN = config.DELIVERYTOKEN
8+
API_KEY = config.API_KEY
9+
DELIVERY_TOKEN = config.DELIVERY_TOKEN
1010
ENVIRONMENT = config.ENVIRONMENT
1111
HOST = config.HOST
1212

tests/test_stack.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from contentstack.stack import ContentstackRegion
88
from contentstack.stack import Stack
99

10-
API_KEY = config.APIKEY
11-
DELIVERY_TOKEN = config.DELIVERYTOKEN
10+
API_KEY = config.API_KEY
11+
DELIVERY_TOKEN = config.DELIVERY_TOKEN
1212
ENVIRONMENT = config.ENVIRONMENT
1313
HOST = config.HOST
1414

@@ -54,7 +54,7 @@ def test_03_stack_endpoint(self):
5454
def test_04_permission_error_api_key(self):
5555
try:
5656
stack_local = contentstack.Stack(
57-
'', config.DELIVERYTOKEN, config.ENVIRONMENT)
57+
'', config.DELIVERY_TOKEN, config.ENVIRONMENT)
5858
self.assertEqual(None, stack_local.api_key)
5959
except PermissionError as e:
6060
if hasattr(e, 'message'):
@@ -63,7 +63,7 @@ def test_04_permission_error_api_key(self):
6363

6464
def test_05_permission_error_delivery_token(self):
6565
try:
66-
stack = contentstack.Stack(config.APIKEY, '', config.ENVIRONMENT)
66+
stack = contentstack.Stack(config.API_KEY, '', config.ENVIRONMENT)
6767
self.assertEqual(None, stack.delivery_token)
6868
except PermissionError as e:
6969
if hasattr(e, 'message'):
@@ -73,7 +73,7 @@ def test_05_permission_error_delivery_token(self):
7373
def test_05_permission_error_environment(self):
7474
try:
7575
stack = contentstack.Stack(
76-
config.APIKEY, config.DELIVERYTOKEN, '')
76+
config.API_KEY, config.DELIVERY_TOKEN, '')
7777
self.assertEqual(None, stack.delivery_token)
7878
except PermissionError as e:
7979
if hasattr(e, 'message'):
@@ -82,22 +82,22 @@ def test_05_permission_error_environment(self):
8282

8383
def test_07_get_api_key(self):
8484
stack = contentstack.Stack(
85-
config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT)
86-
self.assertEqual(config.APIKEY, stack.get_api_key)
85+
config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT)
86+
self.assertEqual(config.API_KEY, stack.get_api_key)
8787

8888
def test_08_get_delivery_token(self):
8989
stack = contentstack.Stack(
90-
config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT)
91-
self.assertEqual(config.DELIVERYTOKEN, stack.get_delivery_token)
90+
config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT)
91+
self.assertEqual(config.DELIVERY_TOKEN, stack.get_delivery_token)
9292

9393
def test_09_get_environment(self):
9494
stack = contentstack.Stack(
95-
config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT)
95+
config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT)
9696
self.assertEqual(config.ENVIRONMENT, stack.get_environment)
9797

9898
def test_10_get_headers(self):
9999
stack = contentstack.Stack(
100-
config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT)
100+
config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT)
101101
self.assertEqual(True, 'api_key' in stack.headers)
102102
self.assertEqual(True, 'access_token' in stack.get_headers)
103103
self.assertEqual(True, 'environment' in stack.get_headers)
@@ -186,19 +186,19 @@ def test_21_content_type(self):
186186
def test_check_region(self):
187187
"""_summary_
188188
"""
189-
_stack = contentstack.Stack(config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT,
189+
_stack = contentstack.Stack(config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT,
190190
host=config.HOST, region=ContentstackRegion.AZURE_NA)
191191
var = _stack.region.value
192192
self.assertEqual('azure-na', var)
193193

194194
def test_22_check_early_access_headers(self):
195195
stack = contentstack.Stack(
196-
config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT, early_access=[])
196+
config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT, early_access=[])
197197
self.assertEqual(True, 'x-header-ea' in stack.get_headers)
198198

199199
def test_23_get_early_access(self):
200200
stack = contentstack.Stack(
201-
config.APIKEY, config.DELIVERYTOKEN, config.ENVIRONMENT, early_access=["taxonomy", "teams"])
201+
config.API_KEY, config.DELIVERY_TOKEN, config.ENVIRONMENT, early_access=["taxonomy", "teams"])
202202
self.assertEqual(self.early_access, stack.get_early_access)
203203

204204
def test_stack_with_custom_logger(self):

tests/test_taxonomies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import contentstack
55
import pytest
66

7-
API_KEY = config.APIKEY
8-
DELIVERY_TOKEN = config.DELIVERYTOKEN
7+
API_KEY = config.API_KEY
8+
DELIVERY_TOKEN = config.DELIVERY_TOKEN
99
ENVIRONMENT = config.ENVIRONMENT
1010
HOST = config.HOST
1111

0 commit comments

Comments
 (0)