blob: cdac903e6742133e594e2cbe4c9240a3679497a4 [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):
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'])