def testGetMetadataById(self): collection = getDbObject(TEST_DB)[TEST_COLLECTION] collection.insert(TEST_DATA) obj = collection.find_one({"_id": TEST_ID}) try: result = getMetadataById(TEST_DB, TEST_ID) self.assertEqual(obj, result) except MetadataDoesNotExistException: self.assertTrue(False) with self.assertRaises(MetadataDoesNotExistException): result = getMetadataById(TEST_DB, BAD_TEST_ID)
def get(self, serviceName, metadata_id): obj = getMetadataById(serviceName, metadata_id) return obj, 200