blob: 590bac36b026c725bf70a50741ae32462b4ae839 [file] [log] [blame]
Daryl Walleck1465d612011-11-02 02:22:15 -05001from nose.plugins.attrib import attr
2from storm import openstack
3import storm.config
4import unittest2 as unittest
5
6
7class 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):
Daryl Wallecke5b83d42011-11-10 14:39:02 -060018 """List of all flavors should contain the expected flavor"""
Daryl Walleck1465d612011-11-02 02:22:15 -050019 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):
Daryl Wallecke5b83d42011-11-10 14:39:02 -060029 """Detailed list of all flavors should contain the expected flavor"""
Daryl Walleck1465d612011-11-02 02:22:15 -050030 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):
Daryl Wallecke5b83d42011-11-10 14:39:02 -060037 """The expected flavor details should be returned"""
Daryl Walleck1465d612011-11-02 02:22:15 -050038 resp, flavor = self.client.get_flavor_details(self.flavor_id)
Daryl Walleckadea1fa2011-11-15 18:36:39 -060039 self.assertEqual(self.flavor_id, str(flavor['id']))