1
# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
3
# Permission is hereby granted, free of charge, to any person obtaining a
4
# copy of this software and associated documentation files (the
5
# "Software"), to deal in the Software without restriction, including
6
# without limitation the rights to use, copy, modify, merge, publish, dis-
7
# tribute, sublicense, and/or sell copies of the Software, and to permit
8
# persons to whom the Software is furnished to do so, subject to the fol-
11
# The above copyright notice and this permission notice shall be included
12
# in all copies or substantial portions of the Software.
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25
from boto.support.layer1 import SupportConnection
26
from boto.support import exceptions
29
class TestSupportLayer1Management(unittest.TestCase):
33
self.api = SupportConnection()
36
def test_as_much_as_possible_before_teardown(self):
37
cases = self.api.describe_cases()
38
preexisting_count = len(cases.get('cases', []))
40
services = self.api.describe_services()
41
self.assertTrue('services' in services)
42
service_codes = [serv['code'] for serv in services['services']]
43
self.assertTrue('amazon-cloudsearch' in service_codes)
45
severity = self.api.describe_severity_levels()
46
self.assertTrue('severityLevels' in severity)
47
severity_codes = [sev['code'] for sev in severity['severityLevels']]
48
self.assertTrue('low' in severity_codes)
50
case_1 = self.api.create_case(
51
subject='TEST: I am a test case.',
52
service_code='amazon-cloudsearch',
53
category_code='other',
54
communication_body="This is a test problem",
58
time.sleep(self.wait_time)
59
case_id = case_1['caseId']
61
new_cases = self.api.describe_cases()
62
self.assertTrue(len(new_cases['cases']) > preexisting_count)
64
result = self.api.add_communication_to_case(
65
communication_body="This is a test solution.",
68
self.assertTrue(result.get('result', False))
69
time.sleep(self.wait_time)
71
final_cases = self.api.describe_cases(case_id_list=[case_id])
72
comms = final_cases['cases'][0]['recentCommunications']\
74
self.assertEqual(len(comms), 2)
76
close_result = self.api.resolve_case(case_id=case_id)