Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 1 | from nose.plugins.attrib import attr |
| 2 | from storm import openstack |
| 3 | import storm.config |
| 4 | import unittest2 as unittest |
| 5 | |
| 6 | |
| 7 | class FlavorsTest(unittest.TestCase): |
| 8 | |
| 9 | @classmethod |
| 10 | def setUpClass(cls): |
| 11 | cls.os = openstack.Manager() |
| 12 | cls.client = cls.os.flavors_client |
| 13 | cls.config = storm.config.StormConfig() |
| 14 | cls.flavor_id = cls.config.env.flavor_ref |
| 15 | |
| 16 | @attr(type='smoke') |
| 17 | def test_list_flavors(self): |
| 18 | """ List of all flavors should contain the expected flavor """ |
| 19 | resp, body = self.client.list_flavors() |
| 20 | flavors = body['flavors'] |
| 21 | |
| 22 | resp, flavor = self.client.get_flavor_details(self.flavor_id) |
| 23 | flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'], |
| 24 | 'name': flavor['name']} |
| 25 | self.assertTrue(flavor_min_detail in flavors) |
| 26 | |
| 27 | @attr(type='smoke') |
| 28 | def test_list_flavors_with_detail(self): |
| 29 | """ Detailed list of all flavors should contain the expected flavor """ |
| 30 | resp, body = self.client.list_flavors_with_detail() |
| 31 | flavors = body['flavors'] |
| 32 | resp, flavor = self.client.get_flavor_details(self.flavor_id) |
| 33 | self.assertTrue(flavor in flavors) |
| 34 | |
| 35 | @attr(type='smoke') |
| 36 | def test_get_flavor(self): |
| 37 | """ The expected flavor details should be returned """ |
| 38 | resp, flavor = self.client.get_flavor_details(self.flavor_id) |
| 39 | self.assertEqual(self.flavor_id, flavor['id']) |