コード例 #1
0
 def test_get_new_instance_show_changed_fields(self):
     # Assert that we create a very dirty object from the cleaned one
     # on build_request
     fake_req = fake_build_request.fake_db_req()
     fields = jsonutils.loads(fake_req['instance'])['nova_object.data']
     build_request = objects.BuildRequest._from_db_object(
         self.context, objects.BuildRequest(), fake_req)
     self.assertEqual(0, len(build_request.instance.obj_what_changed()))
     instance = build_request.get_new_instance(self.context)
     for field in fields:
         self.assertIn(field, instance.obj_what_changed())
         self.assertEqual(getattr(build_request.instance, field),
                          getattr(instance, field))
コード例 #2
0
ファイル: test_build_request.py プロジェクト: amadev/nova
 def test_get_new_instance_show_changed_fields(self):
     # Assert that we create a very dirty object from the cleaned one
     # on build_request
     fake_req = fake_build_request.fake_db_req()
     fields = jsonutils.loads(fake_req['instance'])['nova_object.data']
     build_request = objects.BuildRequest._from_db_object(
         self.context, objects.BuildRequest(), fake_req)
     self.assertEqual(0, len(build_request.instance.obj_what_changed()))
     instance = build_request.get_new_instance(self.context)
     for field in fields:
         self.assertIn(field, instance.obj_what_changed())
         self.assertEqual(getattr(build_request.instance, field),
                          getattr(instance, field))