Пример #1
0
    def testSuccess(self):
        get_response = [{
            'InstanceStatuses': {
                'InstanceStatus': [
                    {'InstanceId': 'i1', 'Status': 'running'},
                    {'InstanceId': 'i2', 'Status': 'stopped'}
                ]
            }
        },
            {
                'InstanceStatuses': {
                    'InstanceStatus': [
                        {'InstanceId': 'i3', 'Status': 'running'},
                    ]
                }
            }]
        expected_result = [ecs.InstanceStatus('i1', 'running'),
                           ecs.InstanceStatus('i2', 'stopped'),
                           ecs.InstanceStatus('i3', 'running')]
        self.conn.get({'Action': 'DescribeInstanceStatus'},
                      paginated=True).AndReturn(get_response)

        self.mox.ReplayAll()
        self.assertEqual(expected_result,
                         self.conn.get_all_instance_status())
        self.mox.VerifyAll()
Пример #2
0
 def testRepr(self):
     is1 = ecs.InstanceStatus('i1', 'running')
     self.assertTrue(repr(is1).startswith(u'<InstanceId i1 is running at'))
Пример #3
0
 def testNotEqual(self):
     is1 = ecs.InstanceStatus('i1', 'running')
     is2 = ecs.InstanceStatus('i1', 'stopped')
     self.assertNotEqual(is1, is2)