def list_lists(): """Displays a list of the lists contained in DROPBOX_LIST_FOLDER""" try: new_hash = listsdotmd.get_folder_hash(db_client, DROPBOX_LIST_FOLDER) except ErrorResponse: abort(404) app.logger.error("Couldn't get index hash from Dropbox") index_in_redis = r.get("index") if index_in_redis: index_in_redis = json.loads(index_in_redis) if not index_in_redis or "hash" not in index_in_redis or (new_hash != index_in_redis["hash"]): all_lists = listsdotmd.index_lists(db_client, DROPBOX_LIST_FOLDER) r.set("index", json.dumps({"data": all_lists, "hash": new_hash})) else: all_lists = index_in_redis["data"] return render_template("index.html", lists=all_lists)
def test_get_folder_hash(self): db_client = MockDropboxClient() self.assertEqual(listsdotmd.get_folder_hash(db_client, '/'), 'efdac89c4da886a9cece1927e6c22977')