'Test list_sizes functionality.'

def test_list_sizes(self):

    sizes = self.driver.list_sizes()
    self.assertEqual(len(sizes), 4)
    size = sizes[0]
    self.assertEqual(size.id, '1')
    self.assertEqual(size.name, 'small')
    self.assertEqual(size.ram, 1024)
    self.assertTrue(((size.cpu is None) or isinstance(size.cpu, int)))
    self.assertTrue(((size.vcpu is None) or isinstance(size.vcpu, int)))
    self.assertEqual(size.cpu, 1)
    self.assertEqual(size.vcpu, None)
    self.assertEqual(size.disk, None)
    self.assertEqual(size.bandwidth, None)
    self.assertEqual(size.price, None)
    size = sizes[1]
    self.assertEqual(size.id, '2')
    self.assertEqual(size.name, 'medium')
    self.assertEqual(size.ram, 4096)
    self.assertTrue(((size.cpu is None) or isinstance(size.cpu, int)))
    self.assertTrue(((size.vcpu is None) or isinstance(size.vcpu, int)))
    self.assertEqual(size.cpu, 4)
    self.assertEqual(size.vcpu, None)
    self.assertEqual(size.disk, None)
    self.assertEqual(size.bandwidth, None)
    self.assertEqual(size.price, None)
    size = sizes[2]
    self.assertEqual(size.id, '3')
    self.assertEqual(size.name, 'large')
    self.assertEqual(size.ram, 8192)
    self.assertTrue(((size.cpu is None) or isinstance(size.cpu, int)))
    self.assertTrue(((size.vcpu is None) or isinstance(size.vcpu, int)))
    self.assertEqual(size.cpu, 8)
    self.assertEqual(size.vcpu, None)
    self.assertEqual(size.disk, None)
    self.assertEqual(size.bandwidth, None)
    self.assertEqual(size.price, None)
    size = sizes[3]
    self.assertEqual(size.id, '4')
    self.assertEqual(size.name, 'custom')
    self.assertEqual(size.ram, 0)
    self.assertEqual(size.cpu, 0)
    self.assertEqual(size.vcpu, None)
    self.assertEqual(size.disk, None)
    self.assertEqual(size.bandwidth, None)
    self.assertEqual(size.price, None)
