Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ test-examples:
python -m pytest examples

lint:
./pylint.sh
./pylint.sh && black --check .

lint-fix:
black .
2 changes: 1 addition & 1 deletion examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

"""Examples"""

# this file is present so that pylint will lint-check the files in this directory
# this file is present so that pylint will lint-check the files in this directory
41 changes: 12 additions & 29 deletions examples/test_case_management_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# Start of Examples for Service: CaseManagementV1
##############################################################################
# region
class TestCaseManagementV1Examples():
class TestCaseManagementV1Examples:
"""
Example Test Class for CaseManagementV1
"""
Expand All @@ -64,16 +64,14 @@ def setup_class(cls):

# begin-common

case_management_service = CaseManagementV1.new_instance(
)
case_management_service = CaseManagementV1.new_instance()

# end-common
assert case_management_service is not None

# Load the configuration
global config
config = read_external_sources(
CaseManagementV1.DEFAULT_SERVICE_NAME)
config = read_external_sources(CaseManagementV1.DEFAULT_SERVICE_NAME)

global resource_crn
resource_crn = config['RESOURCE_CRN']
Expand All @@ -93,14 +91,8 @@ def test_create_case_example(self):
print('\ncreate_case() result:')
# begin-createCase

offering_type = OfferingType(
group='crn_service_name',
key='cloud-object-storage'
)
offering_payload = Offering(
name='Cloud Object Storage',
type=offering_type
)
offering_type = OfferingType(group='crn_service_name', key='cloud-object-storage')
offering_payload = Offering(name='Cloud Object Storage', type=offering_type)

case = case_management_service.create_case(
type='technical',
Expand Down Expand Up @@ -141,10 +133,7 @@ def test_get_case_example(self):
GetCaseEnums.Fields.CREATED_BY,
]

case = case_management_service.get_case(
case_number=case_number,
fields=fields_to_return
).get_result()
case = case_management_service.get_case(case_number=case_number, fields=fields_to_return).get_result()

print(json.dumps(case, indent=2))

Expand Down Expand Up @@ -187,8 +176,7 @@ def test_add_comment_example(self):
# begin-addComment

comment = case_management_service.add_comment(
case_number=case_number,
comment='This is an example comment.'
case_number=case_number, comment='This is an example comment.'
).get_result()

print(json.dumps(comment, indent=2))
Expand All @@ -209,9 +197,7 @@ def test_add_watchlist_example(self):
print('\nadd_watchlist() result:')
# begin-addWatchlist

watchlist_users = [
User(realm='IBMid', user_id='abc@ibm.com')
]
watchlist_users = [User(realm='IBMid', user_id='abc@ibm.com')]

watchlist_add_response = case_management_service.add_watchlist(
case_number=case_number,
Expand All @@ -236,9 +222,7 @@ def test_remove_watchlist_example(self):
print('\nremove_watchlist() result:')
# begin-removeWatchlist

watchlist_users = [
User(realm='IBMid', user_id='abc@ibm.com')
]
watchlist_users = [User(realm='IBMid', user_id='abc@ibm.com')]

watchlist = case_management_service.remove_watchlist(
case_number=case_number,
Expand Down Expand Up @@ -355,8 +339,7 @@ def test_delete_file_example(self):
# begin-deleteFile

attachment_list = case_management_service.delete_file(
case_number=case_number,
file_id=attachment_id
case_number=case_number, file_id=attachment_id
).get_result()

print(json.dumps(attachment_list, indent=2))
Expand Down Expand Up @@ -384,8 +367,7 @@ def test_update_case_status_example(self):
}

case = case_management_service.update_case_status(
case_number=case_number,
status_payload=status_payload_model
case_number=case_number, status_payload=status_payload_model
).get_result()

print(json.dumps(case, indent=2))
Expand All @@ -395,6 +377,7 @@ def test_update_case_status_example(self):
except ApiException as e:
pytest.fail(str(e))


# endregion
##############################################################################
# End of Examples for Service: CaseManagementV1
Expand Down
Loading