~ubuntu-branches/ubuntu/trusty/python-boto/trusty

« back to all changes in this revision

Viewing changes to tests/integration/support/test_layer1.py

  • Committer: Package Import Robot
  • Author(s): Eric Evans
  • Date: 2013-05-10 23:38:14 UTC
  • mfrom: (1.1.10) (14.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130510233814-701dvlop7xfh88i7
Tags: 2.9.2-1
New upstream release (Closes: #700743).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2013 Amazon.com, Inc. or its affiliates.  All Rights Reserved
 
2
#
 
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-
 
9
# lowing conditions:
 
10
#
 
11
# The above copyright notice and this permission notice shall be included
 
12
# in all copies or substantial portions of the Software.
 
13
#
 
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
 
20
# IN THE SOFTWARE.
 
21
#
 
22
import unittest
 
23
import time
 
24
 
 
25
from boto.support.layer1 import SupportConnection
 
26
from boto.support import exceptions
 
27
 
 
28
 
 
29
class TestSupportLayer1Management(unittest.TestCase):
 
30
    support = True
 
31
 
 
32
    def setUp(self):
 
33
        self.api = SupportConnection()
 
34
        self.wait_time = 5
 
35
 
 
36
    def test_as_much_as_possible_before_teardown(self):
 
37
        cases = self.api.describe_cases()
 
38
        preexisting_count = len(cases.get('cases', []))
 
39
 
 
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)
 
44
 
 
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)
 
49
 
 
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",
 
55
            severity_code='low',
 
56
            language='en'
 
57
        )
 
58
        time.sleep(self.wait_time)
 
59
        case_id = case_1['caseId']
 
60
 
 
61
        new_cases = self.api.describe_cases()
 
62
        self.assertTrue(len(new_cases['cases']) > preexisting_count)
 
63
 
 
64
        result = self.api.add_communication_to_case(
 
65
            communication_body="This is a test solution.",
 
66
            case_id=case_id
 
67
        )
 
68
        self.assertTrue(result.get('result', False))
 
69
        time.sleep(self.wait_time)
 
70
 
 
71
        final_cases = self.api.describe_cases(case_id_list=[case_id])
 
72
        comms = final_cases['cases'][0]['recentCommunications']\
 
73
                           ['communications']
 
74
        self.assertEqual(len(comms), 2)
 
75
 
 
76
        close_result = self.api.resolve_case(case_id=case_id)