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()
def testRepr(self): is1 = ecs.InstanceStatus('i1', 'running') self.assertTrue(repr(is1).startswith(u'<InstanceId i1 is running at'))
def testNotEqual(self): is1 = ecs.InstanceStatus('i1', 'running') is2 = ecs.InstanceStatus('i1', 'stopped') self.assertNotEqual(is1, is2)