1 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
2 # and others. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 from snaps.domain.flavor import Flavor
20 class FlavorDomainObjectTests(unittest.TestCase):
22 Tests the construction of the snaps.domain.test.Flavor class
25 def test_construction_kwargs(self):
26 flavor = Flavor(**{'name': 'name', 'id': 'id', 'ram': 10, 'disk': 20,
27 'vcpus': 3, 'ephemeral': 30, 'swap': 100,
28 'rxtx_factor': 5, 'is_public': True})
29 self.assertEqual('name', flavor.name)
30 self.assertEqual('id', flavor.id)
31 self.assertEqual(10, flavor.ram)
32 self.assertEqual(20, flavor.disk)
33 self.assertEqual(3, flavor.vcpus)
34 self.assertEqual(30, flavor.ephemeral)
35 self.assertEqual(100, flavor.swap)
36 self.assertEqual(5, flavor.rxtx_factor)
37 self.assertTrue(flavor.is_public)
39 def test_construction_named(self):
40 flavor = Flavor(is_public=True, rxtx_factor=5, swap=100, ephemeral=30,
41 vcpus=3, disk=20, ram=10, id='id', name='name')
42 self.assertEqual('name', flavor.name)
43 self.assertEqual('id', flavor.id)
44 self.assertEqual(10, flavor.ram)
45 self.assertEqual(20, flavor.disk)
46 self.assertEqual(3, flavor.vcpus)
47 self.assertEqual(30, flavor.ephemeral)
48 self.assertEqual(100, flavor.swap)
49 self.assertEqual(5, flavor.rxtx_factor)
50 self.assertTrue(flavor.is_public)