Ejemplo n.º 1
0
 def test_block_device(self):
     block_device = Mock()
     block_device_properties = (
         'ephemeral_name',
         'snapshot_id',
         'size',
         'delete_on_termination',
         'volume_type'
     )
     for prop in block_device_properties:
         setattr(block_device, prop, 'test')
     values = {"test": block_device}
     result = "test=test:test:test:test:test"
     self.assertEquals(EC2.block_device(values), result)
     self.assertEquals(EC2.block_device(None), '')
Ejemplo n.º 2
0
 def test_reserved_instances_rm(self):
     states = {}
     self.assertEquals(
         EC2.reserved_instances_rm(
             'test', self.tests, states).__dict__['maps'][0].title,
         sentinel.id
     )
     self.assertEquals(states.get('sentinel.id'), 1000)
Ejemplo n.º 3
0
 def test_elastic_ips_rm(self):
     self.assertEquals(
         EC2.elastic_ips_rm('test', self.tests).__dict__['maps'][0].title,
         sentinel.public_ip
     )
Ejemplo n.º 4
0
 def test_images_rm(self):
     self.assertEquals(
         EC2.images_rm('test', self.tests).__dict__['maps'][0].title,
         sentinel.name
     )
Ejemplo n.º 5
0
 def test_vpn_queues_rm(self):
     self.tests[0].name = 'name'
     self.assertEquals(
         EC2.vpn_queues_rm('test', self.tests).__dict__['maps'][0].title,
         'name',
     )
Ejemplo n.º 6
0
 def test_vpn_gateways_rm(self):
     self.assertEquals(
         EC2.vpn_gateways_rm('test', self.tests).__dict__['maps'][0].state,
         sentinel.state
     )
Ejemplo n.º 7
0
 def test_format_size(self):
     self.assertEquals(EC2.format_size(8), '8 GB')
     self.assertEquals(EC2.format_size(1024), '1 TB')
     self.assertEquals(EC2.format_size(None), None)
Ejemplo n.º 8
0
 def test_path_to_pem(self):
     values = ['{"region_name":"test","pem_path":"path"}']
     self.assertEquals(EC2.path_to_pem('test', values), 'path')
     self.assertEquals(EC2.path_to_pem('test1', values), '')
Ejemplo n.º 9
0
 def test_check_tag(self):
     tags = {u'tag': u'test'}
     tags1 = {u'tag': u'test2'}
     value = 'tag: test; tag1: test1; '
     self.assertEquals(EC2.check_tag(value, tags), True)
     self.assertEquals(EC2.check_tag(value, tags1), False)
Ejemplo n.º 10
0
 def test_tags_string(self):
     tags = {u'tag': u'test', u'tag1': u'test1'}
     self.assertEquals(EC2.tags_string(tags), 'tag: test, tag1: test1;')
Ejemplo n.º 11
0
    def test_s3buckets_rm(self):
        self.tests[0].creation_date = 'DDTHH.asdf'
        map = EC2.s3buckets_rm(self.tests).__dict__['maps'][0]

        self.assertEquals(map.title, sentinel.name)
        self.assertEquals(map.creation_date, 'DD HH')
Ejemplo n.º 12
0
 def test_reserved_instances_rm(self):
     self.assertEquals(
         EC2.reserved_instances_rm('test', self.tests).__dict__['maps'][0].title,
         sentinel.id
     )