Exemplo n.º 1
0
    def testWithParams(self):
        get_response = [{
            'Images': {
                'Image': [
                    {'ImageId': 'i1',
                     'ImageVersion': '1.0',
                     'Platform': 'p1',
                     'Description': 'desc',
                     'Size': '50',
                     'Architecture': 'i386',
                     'ImageOwnerAlias': 'system',
                     'OSName': 'os1',
                     'Visibility': 'public'},
                    {'ImageId': 'i2',
                     'Platform': 'p2',
                     'ImageOwnerAlias': 'system'}
                ]
            }
        },
            {
                'Images': {
                    'Image': [
                        {'ImageId': 'i3',
                         'Platform': 'p3',
                         'ImageOwnerAlias': 'other'}
                    ]
                }
            }]
        expected_result = [
            ecs.Image('i1', '1.0', 'p1', 'desc', 50, 'i386', 'system',
                      'os1', 'public'),
            ecs.Image(
                'i2',
                None,
                'p2',
                None,
                None,
                None,
                'system',
                None,
                None),
            ecs.Image('i3', None, 'p3', None, None, None, 'other', None, None)
        ]
        self.conn.get({'Action': 'DescribeImages',
                       'ImageId': 'i1,i2,i3',
                       'ImageOwnerAlias': 'system,other'},
                      paginated=True).AndReturn(get_response)

        self.mox.ReplayAll()
        self.assertEqual(
            expected_result,
            self.conn.describe_images(
                image_ids=['i1', 'i2', 'i3'],
                owner_alias=['system', 'other']))
        self.mox.VerifyAll()
Exemplo n.º 2
0
 def testRepr(self):
     i1 = ecs.Image('i1', '1.0', 'ubuntu12.04', 'standard image', 20,
                    'i386', 'system', 'ubuntu', 'public')
     self.assertTrue(
         repr(i1).startswith(
             u'<Image i1(standard image) for platform ubuntu12.04 and arch i3'
         ))
Exemplo n.º 3
0
 def testRepr(self):
     i1 = ecs.Image('i1', 'version', 'name', 'desc', 1, 'arch', 'owner', 'os')
     self.assertTrue(repr(i1).startswith(
         u'<Image i1(desc) for platform os and arch arch'))
Exemplo n.º 4
0
 def testNotEqual(self):
     i1 = ecs.Image('i1', 'version', 'name', 'desc', 1, 'arch', 'owner', 'os')
     i2 = ecs.Image('i2', 'version', 'name', 'desc', 1, 'arch', 'owner', 'os')
     self.assertNotEqual(i1, i2)
Exemplo n.º 5
0
 def testNotEqual(self):
     i1 = ecs.Image('i1', '1.0', 'ubuntu12.04', 'standard image', 20,
                    'i386', 'system', 'ubuntu', 'public')
     i2 = ecs.Image('i1', '1.0', 'ubuntu12.04', 'standard image', 21,
                    'i386', 'system', 'ubuntu', 'public')
     self.assertNotEqual(i1, i2)