Exemplo n.º 1
0
 def test_delete_doc_find_by_id(self):
   doc = JsonObject()
   updated_doc = self.test_db.update_doc(doc.to_json_map())
   logging.debug(updated_doc)
   doc_id = updated_doc["_id"]
   self.test_db.delete_doc(doc_id)
   self.assertEqual(self.test_db.find_by_id(doc_id), None)
Exemplo n.º 2
0
 def test_find_one(self):
   doc = JsonObject()
   doc.xyz = "xyzvalue"
   updated_doc = self.test_db.update_doc(doc.to_json_map())
   logging.debug(updated_doc)
   found_doc = self.test_db.find_one(find_filter={"xyz": "xyzvalue"})
   self.assertTrue(JsonObject.make_from_dict(updated_doc).equals_ignore_id(JsonObject.make_from_dict(found_doc)))
Exemplo n.º 3
0
 def test_update_doc(self):
   doc = JsonObject()
   updated_doc = self.test_db.update_doc(doc.to_json_map())
   logging.debug(updated_doc)
   updated_doc["xyz"] = "xyzvalue"
   updated_doc = self.test_db.update_doc(updated_doc)
   logging.debug(updated_doc)
   self.assertNotEqual(updated_doc, None)
   self.assertEqual("xyz" in updated_doc, True)
   updated_doc = self.test_db.find_by_id(updated_doc["_id"])
   self.assertNotEqual(updated_doc, None)