Exemplo n.º 1
0
 def test_save_no_fixedip(self, update):
     update.return_value = fake_floating_ip
     floatingip = floating_ip.FloatingIP(context=self.context,
                                         id=123)
     floatingip.fixed_ip = objects.FixedIP(context=self.context,
                                           id=456)
     self.assertNotIn('fixed_ip', update.calls[1])
Exemplo n.º 2
0
 def test_save(self, update):
     update.return_value = fake_floating_ip
     floatingip = floating_ip.FloatingIP(context=self.context,
                                         id=123,
                                         address='1.2.3.4',
                                         host='foo')
     floatingip.obj_reset_changes(['address', 'id'])
     floatingip.save()
     self.assertEqual(set(), floatingip.obj_what_changed())
     update.assert_called_with(self.context, '1.2.3.4', {'host': 'foo'})
Exemplo n.º 3
0
    def test_save_errors(self):
        floatingip = floating_ip.FloatingIP(context=self.context,
                                            id=123, host='foo')
        floatingip.obj_reset_changes()
        floating_ip.address = '1.2.3.4'
        self.assertRaises(exception.ObjectActionError, floatingip.save)

        floatingip.obj_reset_changes()
        floatingip.fixed_ip_id = 1
        self.assertRaises(exception.ObjectActionError, floatingip.save)