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.vm_inst import VmInst, FloatingIp
20 class VmInstDomainObjectTests(unittest.TestCase):
22 Tests the construction of the snaps.domain.test.Image class
25 def test_construction_positional(self):
26 vm_inst = VmInst('name', 'id', dict())
27 self.assertEqual('name', vm_inst.name)
28 self.assertEqual('id', vm_inst.id)
29 self.assertEqual(dict(), vm_inst.networks)
31 def test_construction_named(self):
32 vm_inst = VmInst(networks=dict(), inst_id='id', name='name')
33 self.assertEqual('name', vm_inst.name)
34 self.assertEqual('id', vm_inst.id)
35 self.assertEqual(dict(), vm_inst.networks)
38 class FloatingIpDomainObjectTests(unittest.TestCase):
40 Tests the construction of the snaps.domain.test.Image class
43 def test_construction_positional(self):
44 vm_inst = FloatingIp('id-123', '10.0.0.1')
45 self.assertEqual('id-123', vm_inst.id)
46 self.assertEqual('10.0.0.1', vm_inst.ip)
48 def test_construction_named(self):
49 vm_inst = FloatingIp(ip='10.0.0.1', inst_id='id-123')
50 self.assertEqual('id-123', vm_inst.id)
51 self.assertEqual('10.0.0.1', vm_inst.ip)