From 0a4bbe4b9ed1fa9a83ea718794156a9561999c3c Mon Sep 17 00:00:00 2001
From: Eva Bardou <ebardou@teklia.com>
Date: Tue, 23 Mar 2021 17:57:39 +0100
Subject: [PATCH] Fix some review related code snippets

---
 arkindex_worker/cache.py       |   6 +++---
 tests/data/cache/tables.sqlite | Bin 12288 -> 12288 bytes
 tests/test_cache.py            |   4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arkindex_worker/cache.py b/arkindex_worker/cache.py
index dbcb8dd2..2a36c219 100644
--- a/arkindex_worker/cache.py
+++ b/arkindex_worker/cache.py
@@ -6,7 +6,7 @@ from arkindex_worker import logger
 
 SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements (
     id VARCHAR(32) PRIMARY KEY,
-    parent_id VARCHAR(32) NOT NULL,
+    parent_id VARCHAR(32),
     name TEXT NOT NULL,
     type TEXT NOT NULL,
     polygon TEXT,
@@ -17,8 +17,8 @@ SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements (
 
 CachedElement = namedtuple(
     "CachedElement",
-    ["id", "parent_id", "name", "type", "polygon", "worker_version_id", "initial"],
-    defaults=[0],
+    ["id", "name", "type", "polygon", "worker_version_id", "parent_id", "initial"],
+    defaults=[None, 0],
 )
 
 
diff --git a/tests/data/cache/tables.sqlite b/tests/data/cache/tables.sqlite
index ab1d47aeef67ef2c16d6ca3a2aec4b1b2c1cceee..be29e25631f18d386ad8c644ead09e91792a3d43 100644
GIT binary patch
delta 38
ucmZojXh@il#de&5?>PVQ&4L2qd|ZvSjO^mFvW(5XlTYxaZ?@n+p#T8+K@3m;

delta 47
zcmZojXh@il#kP-uZy*2hjfH-ETup3@?BcSrjLq?rFY={xD){+_DENi?_-wY|KcN5s
DZw?Nf

diff --git a/tests/test_cache.py b/tests/test_cache.py
index 07754469..fde2c681 100644
--- a/tests/test_cache.py
+++ b/tests/test_cache.py
@@ -60,7 +60,7 @@ def test_create_tables_existing_table():
     with open(db_path, "rb") as after_file:
         after = after_file.read()
 
-    assert before == after
+    assert before == after, "Cache was modified"
 
 
 def test_create_tables():
@@ -113,7 +113,7 @@ def test_insert_existing_lines():
     with open(db_path, "rb") as after_file:
         after = after_file.read()
 
-    assert before == after
+    assert before == after, "Cache was modified"
 
 
 def test_insert():
-- 
GitLab