diff options
Diffstat (limited to 'snaps/domain/test')
-rw-r--r-- | snaps/domain/test/vm_inst_tests.py | 16 | ||||
-rw-r--r-- | snaps/domain/test/volume_tests.py | 11 |
2 files changed, 19 insertions, 8 deletions
diff --git a/snaps/domain/test/vm_inst_tests.py b/snaps/domain/test/vm_inst_tests.py index d293373..e288366 100644 --- a/snaps/domain/test/vm_inst_tests.py +++ b/snaps/domain/test/vm_inst_tests.py @@ -23,26 +23,30 @@ class VmInstDomainObjectTests(unittest.TestCase): """ def test_construction_positional(self): - vm_inst = VmInst('name', 'id', '456', '123', dict(), 'kp-name', list()) + vm_inst = VmInst('name', 'id', '456', '123', dict(), 'kp-name', + ['foo', 'bar'], ['123', '456']) self.assertEqual('name', vm_inst.name) self.assertEqual('id', vm_inst.id) self.assertEqual('456', vm_inst.image_id) self.assertEqual('123', vm_inst.flavor_id) self.assertEqual(dict(), vm_inst.networks) self.assertEqual('kp-name', vm_inst.keypair_name) - self.assertEqual(list(), vm_inst.sec_grp_names) + self.assertEqual(['foo', 'bar'], vm_inst.sec_grp_names) + self.assertEqual(['123', '456'], vm_inst.volume_ids) def test_construction_named(self): - vm_inst = VmInst(sec_grp_names=list(), networks=dict(), inst_id='id', - name='name', flavor_id='123', image_id='456', - keypair_name='kp-name') + vm_inst = VmInst( + volume_ids=['123', '456'], sec_grp_names=['foo', 'bar'], + networks=dict(), inst_id='id', name='name', flavor_id='123', + image_id='456', keypair_name='kp-name') self.assertEqual('name', vm_inst.name) self.assertEqual('id', vm_inst.id) self.assertEqual('456', vm_inst.image_id) self.assertEqual('123', vm_inst.flavor_id) self.assertEqual(dict(), vm_inst.networks) self.assertEqual('kp-name', vm_inst.keypair_name) - self.assertEqual(list(), vm_inst.sec_grp_names) + self.assertEqual(['foo', 'bar'], vm_inst.sec_grp_names) + self.assertEqual(['123', '456'], vm_inst.volume_ids) class FloatingIpDomainObjectTests(unittest.TestCase): diff --git a/snaps/domain/test/volume_tests.py b/snaps/domain/test/volume_tests.py index fa0a95a..6feadc9 100644 --- a/snaps/domain/test/volume_tests.py +++ b/snaps/domain/test/volume_tests.py @@ -25,7 +25,7 @@ class VolumeDomainObjectTests(unittest.TestCase): def test_construction_positional(self): volume = Volume('name1', 'id1', 'desc_val1', 2, 'type_val1', - 'avail_zone1', False) + 'avail_zone1', False, [{'attached_at': 'foo'}]) self.assertEqual('name1', volume.name) self.assertEqual('id1', volume.id) self.assertEqual('desc_val1', volume.description) @@ -33,9 +33,13 @@ class VolumeDomainObjectTests(unittest.TestCase): self.assertEqual('type_val1', volume.type) self.assertEqual('avail_zone1', volume.availability_zone) self.assertFalse(volume.multi_attach) + self.assertIsNotNone(volume.attachments) + self.assertTrue(isinstance(volume.attachments[0], dict)) + self.assertEqual(1, len(volume.attachments)) def test_construction_named(self): - volume = Volume(multi_attach=True, availability_zone='avail_zone2', + volume = Volume(attachments=[{'attached_at': 'foo'}], + multi_attach=True, availability_zone='avail_zone2', vol_type='type_val2', size=3, description='desc_val2', volume_id='id2', name='name2') self.assertEqual('name2', volume.name) @@ -45,6 +49,9 @@ class VolumeDomainObjectTests(unittest.TestCase): self.assertEqual('type_val2', volume.type) self.assertEqual('avail_zone2', volume.availability_zone) self.assertTrue(volume.multi_attach) + self.assertIsNotNone(volume.attachments) + self.assertTrue(isinstance(volume.attachments[0], dict)) + self.assertEqual(1, len(volume.attachments)) class VolumeTypeDomainObjectTests(unittest.TestCase): |