Exemplo n.º 1
0
 def test_has_not_changed(self):
     old = {
         "first_name": "John",
         "last_name": "Doe",
         "last_changed_on": None
     }
     new = {"first_name": "John", "last_name": "Doe", "last_changed_on": ""}
     self.assertFalse(has_model_changed(old, new))
Exemplo n.º 2
0
 def _archive_model(self, model, action):
     old = mongo.db.orgs.find_one({'_id': model.get('_id')})
     if has_model_changed(old, model):
         old['id'] = old.get('_id')
         del old['_id']
         old['action'] = action
         log.info("archiving org record",
                  id=old.get('id'), action=action, remote_user=request.remote_user)
         mongo.db.orgs_archive.insert_one(old)
Exemplo n.º 3
0
 def test_has_changed(self):
     old = {"first_name": "John", "last_name": "Doe"}
     new = {"first_name": "John", "last_name": "Smith"}
     self.assertTrue(has_model_changed(old, new))