Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyan99 committed Sep 10, 2019
1 parent 4777f7d commit dc78a87
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def test_delete_wrong_etag(self):
# method: list_configuration_settings
def test_list_configuration_settings_key_label(self):
items = self.get_config_client().list_configuration_settings(
labels=[LABEL], keys=[KEY]
labels=LABEL, keys=[KEY]
)
cnt = 0
for kv in items:
Expand All @@ -239,15 +239,15 @@ def test_list_configuration_settings_key_label(self):
assert cnt == 1

def test_list_configuration_settings_only_label(self):
items = self.get_config_client().list_configuration_settings(labels=[LABEL])
items = self.get_config_client().list_configuration_settings(labels=LABEL)
cnt = 0
for kv in items:
assert kv.label == LABEL
cnt += 1
assert cnt == 1

def test_list_configuration_settings_only_key(self):
items = self.get_config_client().list_configuration_settings(keys=[KEY])
items = self.get_config_client().list_configuration_settings(keys=KEY)
cnt = 0
for kv in items:
assert kv.key == KEY
Expand All @@ -256,7 +256,7 @@ def test_list_configuration_settings_only_key(self):

def test_list_configuration_settings_fields(self):
items = self.get_config_client().list_configuration_settings(
keys=["*"], labels=[LABEL], fields=["key", "content_type"]
keys="*", labels=LABEL, select=["key", "content_type"]
)
cnt = 0
for kv in items:
Expand All @@ -275,7 +275,7 @@ def test_list_configuration_settings_reserved_chars(self):
)
self.to_delete.append(resered_char_kv)
items = self.get_config_client().list_configuration_settings(
labels=[LABEL_RESERVED_CHARS]
labels=LABEL_RESERVED_CHARS
)
cnt = 0
for kv in items:
Expand All @@ -285,7 +285,7 @@ def test_list_configuration_settings_reserved_chars(self):

def test_list_configuration_settings_contains(self):
items = self.get_config_client().list_configuration_settings(
labels=["*" + LABEL + "*"]
labels="*" + LABEL + "*"
)
cnt = 0
for kv in items:
Expand All @@ -297,7 +297,7 @@ def test_list_configuration_settings_correct_etag(self):
to_list_kv = self.test_config_setting
custom_headers = {"If-Match": to_list_kv.etag}
items = self.get_config_client().list_configuration_settings(
keys=[to_list_kv.key], labels=[to_list_kv.label], headers=custom_headers
keys=to_list_kv.key, labels=to_list_kv.label, headers=custom_headers
)
cnt = 0
for kv in items:
Expand All @@ -320,7 +320,7 @@ def test_list_configuration_settings_multi_pages(self):
]
except ResourceExistsError:
pass
items = self.get_config_client().list_configuration_settings(keys=["multi_*"])
items = self.get_config_client().list_configuration_settings(keys="multi_*")
assert len(list(items)) == PAGE_SIZE

# Remove configuration settings
Expand All @@ -335,7 +335,7 @@ def test_list_configuration_settings_multi_pages(self):
pass

def test_list_configuration_settings_null_label(self):
items = self.get_config_client().list_configuration_settings(labels=[""])
items = self.get_config_client().list_configuration_settings(labels="")
assert len(list(items)) > 0

def test_list_configuration_settings_only_accept_time(self):
Expand All @@ -349,7 +349,7 @@ def test_list_configuration_settings_only_accept_time(self):
def test_list_revisions_key_label(self):
to_list1 = self.test_config_setting
items = self.get_config_client().list_revisions(
labels=[to_list1.label], keys=[to_list1.key]
labels=to_list1.label, keys=to_list1.key
)
cnt = 0
for kv in items:
Expand All @@ -358,15 +358,15 @@ def test_list_revisions_key_label(self):
assert cnt >= 2

def test_list_revisions_only_label(self):
items = self.get_config_client().list_revisions(labels=[LABEL])
items = self.get_config_client().list_revisions(labels=LABEL)
cnt = 0
for kv in items:
assert kv.label == LABEL
cnt += 1
assert cnt >= 1

def test_list_revisions_key_no_label(self):
items = self.get_config_client().list_revisions(keys=[KEY])
items = self.get_config_client().list_revisions(keys=KEY)
cnt = 0
for kv in items:
assert kv.key == KEY
Expand All @@ -375,7 +375,7 @@ def test_list_revisions_key_no_label(self):

def test_list_revisions_fields(self):
items = self.get_config_client().list_revisions(
keys=["*"], labels=[LABEL], fields=["key", "content_type"]
keys="*", labels=LABEL, select=["key", "content_type"]
)
for kv in items:
assert (
Expand All @@ -390,7 +390,7 @@ def test_list_revisions_correct_etag(self):
to_list_kv = self.test_config_setting
custom_headers = {"If-Match": to_list_kv.etag}
items = self.get_config_client().list_revisions(
keys=[to_list_kv.key], labels=[to_list_kv.label], headers=custom_headers
keys=to_list_kv.key, labels=to_list_kv.label, headers=custom_headers
)
cnt = 0
for kv in items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from . import app_config_test_settings_fake as fake_settings

PAGE_SIZE = 100
KEY_UUID = "test_key_a6af8952-54a6-11e9-b600-2816a84d0309"
LABEL_UUID = "1d7b2b28-549e-11e9-b51c-2816a84d0309"
KEY_UUID = "test_key_a6af8952-54a6-11e9-b600-2816a84d0307"
LABEL_UUID = "1d7b2b28-549e-11e9-b51c-2816a84d0307"
KEY = "PYTHON_UNIT_" + KEY_UUID
LABEL = "test_label1_" + LABEL_UUID
LABEL_RESERVED_CHARS = "test_label2_*, \\" + LABEL_UUID # contains reserved chars *,\
Expand Down Expand Up @@ -77,7 +77,7 @@ def _add_for_test(self, kv):
exist = bool(
list(
self.get_config_client().list_configuration_settings(
keys=[kv.key], labels=[kv.label]
keys=kv.key, labels=kv.label
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_delete_wrong_etag(self):
# method: list_configuration_settings
def test_list_configuration_settings_key_label(self):
items = self.get_config_client().list_configuration_settings(
labels=[LABEL], keys=[KEY]
labels=LABEL, keys=KEY
)
cnt = 0
for kv in items:
Expand All @@ -240,15 +240,15 @@ def test_list_configuration_settings_key_label(self):
assert cnt == 1

def test_list_configuration_settings_only_label(self):
items = self.get_config_client().list_configuration_settings(labels=[LABEL])
items = self.get_config_client().list_configuration_settings(labels=LABEL)
cnt = 0
for kv in items:
assert kv.label == LABEL
cnt += 1
assert cnt == 1

def test_list_configuration_settings_only_key(self):
items = self.get_config_client().list_configuration_settings(keys=[KEY])
items = self.get_config_client().list_configuration_settings(keys=KEY)
cnt = 0
for kv in items:
assert kv.key == KEY
Expand All @@ -257,7 +257,7 @@ def test_list_configuration_settings_only_key(self):

def test_list_configuration_settings_fields(self):
items = self.get_config_client().list_configuration_settings(
keys=["*"], labels=[LABEL], fields=["key", "content_type"]
keys="*", labels=LABEL, select=["key", "content_type"]
)
cnt = 0
for kv in items:
Expand All @@ -276,7 +276,7 @@ def test_list_configuration_settings_reserved_chars(self):
)
self.to_delete.append(resered_char_kv)
items = self.get_config_client().list_configuration_settings(
labels=[LABEL_RESERVED_CHARS]
labels=LABEL_RESERVED_CHARS
)
cnt = 0
for kv in items:
Expand All @@ -286,7 +286,7 @@ def test_list_configuration_settings_reserved_chars(self):

def test_list_configuration_settings_contains(self):
items = self.get_config_client().list_configuration_settings(
labels=["*" + LABEL + "*"]
labels="*" + LABEL + "*"
)
cnt = 0
for kv in items:
Expand All @@ -298,7 +298,7 @@ def test_list_configuration_settings_correct_etag(self):
to_list_kv = self.test_config_setting
custom_headers = {"If-Match": to_list_kv.etag}
items = self.get_config_client().list_configuration_settings(
keys=[to_list_kv.key], labels=[to_list_kv.label], headers=custom_headers
keys=to_list_kv.key, labels=to_list_kv.label, headers=custom_headers
)
cnt = 0
for kv in items:
Expand All @@ -321,7 +321,7 @@ def test_list_configuration_settings_multi_pages(self):
]
except ResourceExistsError:
pass
items = self.get_config_client().list_configuration_settings(keys=["multi_*"])
items = self.get_config_client().list_configuration_settings(keys="multi_*")
assert len(list(items)) == PAGE_SIZE

# Remove the configuration settings
Expand All @@ -336,7 +336,7 @@ def test_list_configuration_settings_multi_pages(self):
pass

def test_list_configuration_settings_null_label(self):
items = self.get_config_client().list_configuration_settings(labels=[""])
items = self.get_config_client().list_configuration_settings(labels="")
assert len(list(items)) > 0

def test_list_configuration_settings_only_accept_time(self):
Expand All @@ -350,7 +350,7 @@ def test_list_configuration_settings_only_accept_time(self):
def test_list_revisions_key_label(self):
to_list1 = self.test_config_setting
items = self.get_config_client().list_revisions(
labels=[to_list1.label], keys=[to_list1.key]
labels=to_list1.label, keys=to_list1.key
)
cnt = 0
for kv in items:
Expand All @@ -359,15 +359,15 @@ def test_list_revisions_key_label(self):
assert cnt >= 2

def test_list_revisions_only_label(self):
items = self.get_config_client().list_revisions(labels=[LABEL])
items = self.get_config_client().list_revisions(labels=LABEL)
cnt = 0
for kv in items:
assert kv.label == LABEL
cnt += 1
assert cnt >= 1

def test_list_revisions_key_no_label(self):
items = self.get_config_client().list_revisions(keys=[KEY])
items = self.get_config_client().list_revisions(keys=KEY)
cnt = 0
for kv in items:
assert kv.key == KEY
Expand All @@ -376,7 +376,7 @@ def test_list_revisions_key_no_label(self):

def test_list_revisions_fields(self):
items = self.get_config_client().list_revisions(
keys=["*"], labels=[LABEL], fields=["key", "content_type"]
keys="*", labels=LABEL, select=["key", "content_type"]
)
for kv in items:
assert (
Expand All @@ -391,7 +391,7 @@ def test_list_revisions_correct_etag(self):
to_list_kv = self.test_config_setting
custom_headers = {"If-Match": to_list_kv.etag}
items = self.get_config_client().list_revisions(
keys=[to_list_kv.key], labels=[to_list_kv.label], headers=custom_headers
keys=to_list_kv.key, labels=to_list_kv.label, headers=custom_headers
)
cnt = 0
for kv in items:
Expand Down

0 comments on commit dc78a87

Please sign in to comment.