about summary refs log tree commit diff stats
path: root/tests_integration
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-05-26 09:14:54 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-05-26 09:14:54 +0300
commitbce655ba8a5ba4727f9c4ee11c5fefa07dd479fc (patch)
tree44a231872d249389a17d66721522f13613232384 /tests_integration
parent8e05edde686b28a5b1102c4823bb4f887352fa72 (diff)
downloadthe-epube-bce655ba8a5ba4727f9c4ee11c5fefa07dd479fc.tar.gz
the-epube-bce655ba8a5ba4727f9c4ee11c5fefa07dd479fc.tar.xz
add todo & integration test data
Diffstat (limited to 'tests_integration')
-rw-r--r--tests_integration/run.sh11
-rw-r--r--tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.epubbin0 -> 280805 bytes
-rw-r--r--tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.original_epubbin0 -> 278915 bytes
-rw-r--r--tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/cover.jpgbin0 -> 27588 bytes
-rw-r--r--tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/metadata.opf24
-rw-r--r--tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.epubbin0 -> 71470 bytes
-rw-r--r--tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.original_epubbin0 -> 54239 bytes
-rw-r--r--tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/cover.jpgbin0 -> 16960 bytes
-rw-r--r--tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/metadata.opf21
-rw-r--r--tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.epubbin0 -> 293933 bytes
-rw-r--r--tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.original_epubbin0 -> 293468 bytes
-rw-r--r--tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/cover.jpgbin0 -> 110481 bytes
-rw-r--r--tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/metadata.opf26
-rw-r--r--tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.epubbin0 -> 738815 bytes
-rw-r--r--tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.original_epubbin0 -> 550430 bytes
-rw-r--r--tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/cover.jpgbin0 -> 50345 bytes
-rw-r--r--tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/metadata.opf29
-rw-r--r--tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.epubbin0 -> 312482 bytes
-rw-r--r--tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.original_epubbin0 -> 387025 bytes
-rw-r--r--tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/cover.jpgbin0 -> 126788 bytes
-rw-r--r--tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/metadata.opf31
-rw-r--r--tests_integration/test_data/books/metadata.dbbin0 -> 376832 bytes
-rw-r--r--tests_integration/test_data/books/metadata_db_prefs_backup.json608
23 files changed, 747 insertions, 3 deletions
diff --git a/tests_integration/run.sh b/tests_integration/run.sh
index 328c090..f6214dd 100644
--- a/tests_integration/run.sh
+++ b/tests_integration/run.sh
@@ -146,6 +146,8 @@ log "Step 2/5: Creating database user and database ..."
 # Step 3: Run schema migrations
 log "Step 3/5: Running schema migrations ..."
 
+export EPUBE_BOOKS_DIR="$(pwd)/test_data/books"
+export EPUBE_CALIBRE_DB="${EPUBE_BOOKS_DIR}/metadata.db"
 export EPUBE_DB_TYPE=pgsql
 export EPUBE_DB_HOST=localhost
 export EPUBE_DB_PORT=${PG_PORT}
@@ -162,6 +164,7 @@ export OTEL_PHP_DISABLED_INSTRUMENTATIONS=pdo,guzzle,psr18,slim,io
 export IS_INTEGRATION_TESTING=true
 
 $PHP_BIN ./update.php --update-schema=force-yes
+$PHP_BIN ./update.php --user-add "test:test"
 
 # Step 4: Start PHP development server
 log "Step 4/5: Starting PHP development servers, ports: $PHP_PORT1 / $PHP_PORT2..."
@@ -179,7 +182,7 @@ PHP_SERVER2_PID=$!
 # Wait for PHP server to be ready
 log "Waiting for PHP server 1 to start ..."
 for i in $(seq 1 30); do
-	if curl -s "http://localhost:$PHP_PORT1/api/" >/dev/null 2>&1; then
+	if curl -s "http://localhost:$PHP_PORT1/" >/dev/null 2>&1; then
 		log "PHP server is ready."
 		break
 	fi
@@ -193,7 +196,7 @@ done
 
 log "Waiting for PHP server 2 to start ..."
 for i in $(seq 1 30); do
-	if curl -s "http://localhost:$PHP_PORT2/api/" >/dev/null 2>&1; then
+	if curl -s "http://localhost:$PHP_PORT2/" >/dev/null 2>&1; then
 		log "PHP server is ready."
 		break
 	fi
@@ -205,11 +208,13 @@ for i in $(seq 1 30); do
 	sleep 0.5
 done
 
+# curl -vsL "http://localhost:$PHP_PORT1/login.php?op=perform-login&user=test&password=test"
+
 # Step 5: Run PHPUnit
 log "Step 5/5: Running PHPUnit integration tests ..."
 
 # Export env vars for tests
-export API_URL="http://localhost:$PHP_PORT1/api/index.php"
+export API_URL="http://localhost:$PHP_PORT1/backend.php"
 export APP_URL="http://localhost:$PHP_PORT2"
 
 # Run PHPUnit with the integration testsuite
diff --git a/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.epub b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.epub
new file mode 100644
index 0000000..88c321c
--- /dev/null
+++ b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.epub
Binary files differdiff --git a/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.original_epub b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.original_epub
new file mode 100644
index 0000000..eb93244
--- /dev/null
+++ b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/The Adventures of Sherlock Holm - Arthur Conan Doyle.original_epub
Binary files differdiff --git a/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/cover.jpg b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/cover.jpg
new file mode 100644
index 0000000..1a5295d
--- /dev/null
+++ b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/cover.jpg
Binary files differdiff --git a/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/metadata.opf b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/metadata.opf
new file mode 100644
index 0000000..d0fd575
--- /dev/null
+++ b/tests_integration/test_data/books/Arthur Conan Doyle/The Adventures of Sherlock Holmes (3)/metadata.opf
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='utf-8'?>
+<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
+    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
+        <dc:identifier opf:scheme="calibre" id="calibre_id">3</dc:identifier>
+        <dc:identifier opf:scheme="uuid" id="uuid_id">8ead20d0-ef11-4806-ad60-4cb477930f4c</dc:identifier>
+        <dc:title>The Adventures of Sherlock Holmes</dc:title>
+        <dc:creator opf:file-as="Doyle, Arthur Conan" opf:role="aut">Arthur Conan Doyle</dc:creator>
+        <dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (4.3.0) [https://calibre-ebook.com]</dc:contributor>
+        <dc:date>1999-02-28T21:00:00+00:00</dc:date>
+        <dc:identifier opf:scheme="URI">http://www.gutenberg.org/ebooks/1661</dc:identifier>
+        <dc:language>eng</dc:language>
+        <dc:subject>Holmes</dc:subject>
+        <dc:subject>Sherlock (Fictitious character) -- Fiction</dc:subject>
+        <dc:subject>Private investigators -- England -- Fiction</dc:subject>
+        <dc:subject>Detective and mystery stories</dc:subject>
+        <dc:subject>English</dc:subject>
+        <meta content="{&quot;Arthur Conan Doyle&quot;: &quot;&quot;}" name="calibre:author_link_map"/>
+        <meta content="2019-11-13T13:45:45.813000+00:00" name="calibre:timestamp"/>
+        <meta content="Adventures of Sherlock Holmes, The" name="calibre:title_sort"/>
+    </metadata>
+    <guide>
+        <reference href="cover.jpg" title="Cover" type="cover"/>
+    </guide>
+</package>
diff --git a/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.epub b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.epub
new file mode 100644
index 0000000..cafadd9
--- /dev/null
+++ b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.epub
Binary files differdiff --git a/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.original_epub b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.original_epub
new file mode 100644
index 0000000..90025ab
--- /dev/null
+++ b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/Metamorphosis - Franz Kafka.original_epub
Binary files differdiff --git a/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/cover.jpg b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/cover.jpg
new file mode 100644
index 0000000..af624b9
--- /dev/null
+++ b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/cover.jpg
Binary files differdiff --git a/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/metadata.opf b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/metadata.opf
new file mode 100644
index 0000000..01fd590
--- /dev/null
+++ b/tests_integration/test_data/books/Franz Kafka/Metamorphosis (4)/metadata.opf
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='utf-8'?>
+<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
+    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
+        <dc:identifier opf:scheme="calibre" id="calibre_id">4</dc:identifier>
+        <dc:identifier opf:scheme="uuid" id="uuid_id">1c9faed9-817c-4ba2-bdd0-4571a9d82eba</dc:identifier>
+        <dc:title>Metamorphosis</dc:title>
+        <dc:creator opf:file-as="Kafka, Franz" opf:role="aut">Franz Kafka</dc:creator>
+        <dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (4.3.0) [https://calibre-ebook.com]</dc:contributor>
+        <dc:date>2005-08-16T21:00:00+00:00</dc:date>
+        <dc:identifier opf:scheme="URI">http://www.gutenberg.org/ebooks/5200</dc:identifier>
+        <dc:language>eng</dc:language>
+        <dc:subject>Psychological fiction</dc:subject>
+        <dc:subject>Metamorphosis -- Fiction</dc:subject>
+        <meta content="{&quot;Franz Kafka&quot;: &quot;&quot;}" name="calibre:author_link_map"/>
+        <meta content="2019-11-14T10:03:47.389000+00:00" name="calibre:timestamp"/>
+        <meta content="Metamorphosis" name="calibre:title_sort"/>
+    </metadata>
+    <guide>
+        <reference href="cover.jpg" title="Cover" type="cover"/>
+    </guide>
+</package>
diff --git a/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.epub b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.epub
new file mode 100644
index 0000000..ffe1e10
--- /dev/null
+++ b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.epub
Binary files differdiff --git a/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.original_epub b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.original_epub
new file mode 100644
index 0000000..15ae865
--- /dev/null
+++ b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/The War of the Worlds - H. G. Wells.original_epub
Binary files differdiff --git a/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/cover.jpg b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/cover.jpg
new file mode 100644
index 0000000..79fb8c1
--- /dev/null
+++ b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/cover.jpg
Binary files differdiff --git a/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/metadata.opf b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/metadata.opf
new file mode 100644
index 0000000..ed57036
--- /dev/null
+++ b/tests_integration/test_data/books/H. G. Wells/The War of the Worlds (6)/metadata.opf
@@ -0,0 +1,26 @@
+<?xml version='1.0' encoding='utf-8'?>
+<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
+    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
+        <dc:identifier opf:scheme="calibre" id="calibre_id">6</dc:identifier>
+        <dc:identifier opf:scheme="uuid" id="uuid_id">ec2ae57c-c52b-4503-88fe-22450567b92b</dc:identifier>
+        <dc:title>The War of the Worlds</dc:title>
+        <dc:creator opf:file-as="Wells, H. G. (Herbert George)" opf:role="aut">H. G. Wells</dc:creator>
+        <dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (4.3.0) [https://calibre-ebook.com]</dc:contributor>
+        <dc:date>2004-09-30T21:00:00+00:00</dc:date>
+        <dc:identifier opf:scheme="URI">http://www.gutenberg.org/ebooks/36</dc:identifier>
+        <dc:language>eng</dc:language>
+        <dc:subject>Science fiction</dc:subject>
+        <dc:subject>War stories</dc:subject>
+        <dc:subject>Martians -- Fiction</dc:subject>
+        <dc:subject>Mars (Planet) -- Fiction</dc:subject>
+        <dc:subject>Space warfare -- Fiction</dc:subject>
+        <dc:subject>Imaginary wars and battles -- Fiction</dc:subject>
+        <dc:subject>Life on other planets -- Fiction</dc:subject>
+        <meta content="{&quot;H. G. Wells&quot;: &quot;&quot;}" name="calibre:author_link_map"/>
+        <meta content="2019-11-14T10:05:59.586000+00:00" name="calibre:timestamp"/>
+        <meta content="War of the Worlds, The" name="calibre:title_sort"/>
+    </metadata>
+    <guide>
+        <reference href="cover.jpg" title="Cover" type="cover"/>
+    </guide>
+</package>
diff --git a/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.epub b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.epub
new file mode 100644
index 0000000..5802f7f
--- /dev/null
+++ b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.epub
Binary files differdiff --git a/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.original_epub b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.original_epub
new file mode 100644
index 0000000..38c03bb
--- /dev/null
+++ b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/Moby Dick; Or, The Whale - Herman Melville.original_epub
Binary files differdiff --git a/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/cover.jpg b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/cover.jpg
new file mode 100644
index 0000000..0d4ca84
--- /dev/null
+++ b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/cover.jpg
Binary files differdiff --git a/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/metadata.opf b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/metadata.opf
new file mode 100644
index 0000000..be46fd2
--- /dev/null
+++ b/tests_integration/test_data/books/Herman Melville/Moby Dick; Or, The Whale (5)/metadata.opf
@@ -0,0 +1,29 @@
+<?xml version='1.0' encoding='utf-8'?>
+<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
+    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
+        <dc:identifier opf:scheme="calibre" id="calibre_id">5</dc:identifier>
+        <dc:identifier opf:scheme="uuid" id="uuid_id">c8c70865-7727-42b9-8656-07f6a5d525b9</dc:identifier>
+        <dc:title>Moby Dick; Or, The Whale</dc:title>
+        <dc:creator opf:file-as="Melville, Herman" opf:role="aut">Herman Melville</dc:creator>
+        <dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (4.3.0) [https://calibre-ebook.com]</dc:contributor>
+        <dc:date>2001-06-30T21:00:00+00:00</dc:date>
+        <dc:identifier opf:scheme="URI">http://www.gutenberg.org/ebooks/2701</dc:identifier>
+        <dc:language>eng</dc:language>
+        <dc:subject>Whaling -- Fiction</dc:subject>
+        <dc:subject>Sea stories</dc:subject>
+        <dc:subject>Psychological fiction</dc:subject>
+        <dc:subject>Ship captains -- Fiction</dc:subject>
+        <dc:subject>Adventure stories</dc:subject>
+        <dc:subject>Mentally ill -- Fiction</dc:subject>
+        <dc:subject>Ahab</dc:subject>
+        <dc:subject>Captain (Fictitious character) -- Fiction</dc:subject>
+        <dc:subject>Whales -- Fiction</dc:subject>
+        <dc:subject>Whaling ships -- Fiction</dc:subject>
+        <meta content="{&quot;Herman Melville&quot;: &quot;&quot;}" name="calibre:author_link_map"/>
+        <meta content="2019-11-14T10:03:47.825000+00:00" name="calibre:timestamp"/>
+        <meta content="Moby Dick; Or, The Whale" name="calibre:title_sort"/>
+    </metadata>
+    <guide>
+        <reference href="cover.jpg" title="Cover" type="cover"/>
+    </guide>
+</package>
diff --git a/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.epub b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.epub
new file mode 100644
index 0000000..a0d2a32
--- /dev/null
+++ b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.epub
Binary files differdiff --git a/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.original_epub b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.original_epub
new file mode 100644
index 0000000..c5906ef
--- /dev/null
+++ b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/Adventures of Huckleberry Finn - Mark Twain.original_epub
Binary files differdiff --git a/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/cover.jpg b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/cover.jpg
new file mode 100644
index 0000000..541a3a0
--- /dev/null
+++ b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/cover.jpg
Binary files differdiff --git a/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/metadata.opf b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/metadata.opf
new file mode 100644
index 0000000..278f432
--- /dev/null
+++ b/tests_integration/test_data/books/Mark Twain/Adventures of Huckleberry Finn (2)/metadata.opf
@@ -0,0 +1,31 @@
+<?xml version='1.0' encoding='utf-8'?>
+<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
+    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
+        <dc:identifier opf:scheme="calibre" id="calibre_id">2</dc:identifier>
+        <dc:identifier opf:scheme="uuid" id="uuid_id">61de784f-88c3-46aa-a53a-2fad0252dce1</dc:identifier>
+        <dc:title>Adventures of Huckleberry Finn</dc:title>
+        <dc:creator opf:file-as="Twain, Mark" opf:role="aut">Mark Twain</dc:creator>
+        <dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (4.3.0) [https://calibre-ebook.com]</dc:contributor>
+        <dc:date>2004-06-28T21:00:00+00:00</dc:date>
+        <dc:identifier opf:scheme="URI">http://www.gutenberg.org/ebooks/76</dc:identifier>
+        <dc:language>eng</dc:language>
+        <dc:subject>Humorous stories</dc:subject>
+        <dc:subject>Bildungsromans</dc:subject>
+        <dc:subject>Boys -- Fiction</dc:subject>
+        <dc:subject>Male friendship -- Fiction</dc:subject>
+        <dc:subject>Adventure stories</dc:subject>
+        <dc:subject>Missouri -- Fiction</dc:subject>
+        <dc:subject>Race relations -- Fiction</dc:subject>
+        <dc:subject>Runaway children -- Fiction</dc:subject>
+        <dc:subject>Finn</dc:subject>
+        <dc:subject>Huckleberry (Fictitious character) -- Fiction</dc:subject>
+        <dc:subject>Fugitive slaves -- Fiction</dc:subject>
+        <dc:subject>Mississippi River -- Fiction</dc:subject>
+        <meta content="{&quot;Mark Twain&quot;: &quot;&quot;}" name="calibre:author_link_map"/>
+        <meta content="2019-11-13T13:45:17.986000+00:00" name="calibre:timestamp"/>
+        <meta content="Adventures of Huckleberry Finn" name="calibre:title_sort"/>
+    </metadata>
+    <guide>
+        <reference href="cover.jpg" title="Cover" type="cover"/>
+    </guide>
+</package>
diff --git a/tests_integration/test_data/books/metadata.db b/tests_integration/test_data/books/metadata.db
new file mode 100644
index 0000000..5f1f8fb
--- /dev/null
+++ b/tests_integration/test_data/books/metadata.db
Binary files differdiff --git a/tests_integration/test_data/books/metadata_db_prefs_backup.json b/tests_integration/test_data/books/metadata_db_prefs_backup.json
new file mode 100644
index 0000000..6907625
--- /dev/null
+++ b/tests_integration/test_data/books/metadata_db_prefs_backup.json
@@ -0,0 +1,608 @@
+{
+  "saved_searches": {}, 
+  "field_metadata": {
+    "comments": {
+      "kind": "field", 
+      "search_terms": [
+        "comments", 
+        "comment"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Comments", 
+      "rec_index": 7, 
+      "column": null, 
+      "label": "comments"
+    }, 
+    "uuid": {
+      "kind": "field", 
+      "search_terms": [
+        "uuid"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": null, 
+      "rec_index": 16, 
+      "column": null, 
+      "label": "uuid"
+    }, 
+    "cover": {
+      "kind": "field", 
+      "search_terms": [
+        "cover"
+      ], 
+      "datatype": "int", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Cover", 
+      "rec_index": 17, 
+      "column": null, 
+      "label": "cover"
+    }, 
+    "pubdate": {
+      "kind": "field", 
+      "search_terms": [
+        "pubdate"
+      ], 
+      "datatype": "datetime", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {
+        "date_format": "MMM yyyy"
+      }, 
+      "is_custom": false, 
+      "name": "Published", 
+      "rec_index": 15, 
+      "column": null, 
+      "label": "pubdate"
+    }, 
+    "au_map": {
+      "kind": "field", 
+      "search_terms": [], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {
+        "list_to_ui": null, 
+        "cache_to_list": ",", 
+        "ui_to_list": null
+      }, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": null, 
+      "rec_index": 18, 
+      "column": null, 
+      "label": "au_map"
+    }, 
+    "path": {
+      "kind": "field", 
+      "search_terms": [], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Path", 
+      "rec_index": 14, 
+      "column": null, 
+      "label": "path"
+    }, 
+    "author_sort": {
+      "kind": "field", 
+      "search_terms": [
+        "author_sort"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Author sort", 
+      "rec_index": 12, 
+      "column": null, 
+      "label": "author_sort"
+    }, 
+    "series_index": {
+      "kind": "field", 
+      "search_terms": [
+        "series_index"
+      ], 
+      "datatype": "float", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": null, 
+      "rec_index": 10, 
+      "column": null, 
+      "label": "series_index"
+    }, 
+    "news": {
+      "kind": "category", 
+      "search_terms": [], 
+      "datatype": null, 
+      "table": "news", 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "name", 
+      "is_custom": false, 
+      "name": "News", 
+      "column": "name", 
+      "label": "news"
+    }, 
+    "rating": {
+      "kind": "field", 
+      "search_terms": [
+        "rating"
+      ], 
+      "datatype": "rating", 
+      "rec_index": 5, 
+      "table": "ratings", 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "rating", 
+      "is_custom": false, 
+      "name": "Rating", 
+      "link_column": "rating", 
+      "column": "rating", 
+      "label": "rating"
+    }, 
+    "sort": {
+      "kind": "field", 
+      "search_terms": [
+        "title_sort"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Title sort", 
+      "rec_index": 11, 
+      "column": null, 
+      "label": "sort"
+    }, 
+    "series": {
+      "kind": "field", 
+      "search_terms": [
+        "series"
+      ], 
+      "datatype": "series", 
+      "rec_index": 8, 
+      "table": "series", 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "(title_sort(name))", 
+      "is_custom": false, 
+      "name": "Series", 
+      "link_column": "series", 
+      "column": "name", 
+      "label": "series"
+    }, 
+    "last_modified": {
+      "kind": "field", 
+      "search_terms": [
+        "last_modified"
+      ], 
+      "datatype": "datetime", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {
+        "date_format": "dd MMM yyyy"
+      }, 
+      "is_custom": false, 
+      "name": "Modified", 
+      "rec_index": 19, 
+      "column": null, 
+      "label": "last_modified"
+    }, 
+    "timestamp": {
+      "kind": "field", 
+      "search_terms": [
+        "date"
+      ], 
+      "datatype": "datetime", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {
+        "date_format": "dd MMM yyyy"
+      }, 
+      "is_custom": false, 
+      "name": "Date", 
+      "rec_index": 3, 
+      "column": null, 
+      "label": "timestamp"
+    }, 
+    "marked": {
+      "kind": "field", 
+      "search_terms": [
+        "marked"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": null, 
+      "rec_index": 23, 
+      "column": null, 
+      "label": "marked"
+    }, 
+    "title": {
+      "kind": "field", 
+      "search_terms": [
+        "title"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Title", 
+      "rec_index": 1, 
+      "column": null, 
+      "label": "title"
+    }, 
+    "tags": {
+      "kind": "field", 
+      "search_terms": [
+        "tags", 
+        "tag"
+      ], 
+      "datatype": "text", 
+      "rec_index": 6, 
+      "table": "tags", 
+      "is_multiple": {
+        "list_to_ui": ", ", 
+        "cache_to_list": ",", 
+        "ui_to_list": ","
+      }, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "name", 
+      "is_custom": false, 
+      "name": "Tags", 
+      "link_column": "tag", 
+      "column": "name", 
+      "label": "tags"
+    }, 
+    "publisher": {
+      "kind": "field", 
+      "search_terms": [
+        "publisher"
+      ], 
+      "datatype": "text", 
+      "rec_index": 9, 
+      "table": "publishers", 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "name", 
+      "is_custom": false, 
+      "name": "Publisher", 
+      "link_column": "publisher", 
+      "column": "name", 
+      "label": "publisher"
+    }, 
+    "formats": {
+      "kind": "field", 
+      "search_terms": [
+        "formats", 
+        "format"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {
+        "list_to_ui": ", ", 
+        "cache_to_list": ",", 
+        "ui_to_list": ","
+      }, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Formats", 
+      "rec_index": 13, 
+      "column": null, 
+      "label": "formats"
+    }, 
+    "languages": {
+      "kind": "field", 
+      "search_terms": [
+        "languages", 
+        "language"
+      ], 
+      "datatype": "text", 
+      "rec_index": 21, 
+      "table": "languages", 
+      "is_multiple": {
+        "list_to_ui": ", ", 
+        "cache_to_list": ",", 
+        "ui_to_list": ","
+      }, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "lang_code", 
+      "is_custom": false, 
+      "name": "Languages", 
+      "link_column": "lang_code", 
+      "column": "lang_code", 
+      "label": "languages"
+    }, 
+    "ondevice": {
+      "kind": "field", 
+      "search_terms": [
+        "ondevice"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "On device", 
+      "rec_index": 22, 
+      "column": null, 
+      "label": "ondevice"
+    }, 
+    "id": {
+      "kind": "field", 
+      "search_terms": [
+        "id"
+      ], 
+      "datatype": "int", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": null, 
+      "rec_index": 0, 
+      "column": null, 
+      "label": "id"
+    }, 
+    "identifiers": {
+      "kind": "field", 
+      "search_terms": [
+        "identifiers", 
+        "identifier", 
+        "isbn"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {
+        "list_to_ui": ", ", 
+        "cache_to_list": ",", 
+        "ui_to_list": ","
+      }, 
+      "is_csp": true, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Identifiers", 
+      "rec_index": 20, 
+      "column": null, 
+      "label": "identifiers"
+    }, 
+    "size": {
+      "kind": "field", 
+      "search_terms": [
+        "size"
+      ], 
+      "datatype": "float", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Size", 
+      "rec_index": 4, 
+      "column": null, 
+      "label": "size"
+    }, 
+    "series_sort": {
+      "kind": "field", 
+      "search_terms": [
+        "series_sort"
+      ], 
+      "datatype": "text", 
+      "table": null, 
+      "is_multiple": {}, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": false, 
+      "display": {}, 
+      "is_custom": false, 
+      "name": "Series sort", 
+      "rec_index": 24, 
+      "column": null, 
+      "label": "series_sort"
+    }, 
+    "authors": {
+      "kind": "field", 
+      "search_terms": [
+        "authors", 
+        "author"
+      ], 
+      "datatype": "text", 
+      "rec_index": 2, 
+      "table": "authors", 
+      "is_multiple": {
+        "list_to_ui": " & ", 
+        "cache_to_list": ",", 
+        "ui_to_list": "&"
+      }, 
+      "is_csp": false, 
+      "is_editable": true, 
+      "is_category": true, 
+      "display": {}, 
+      "category_sort": "sort", 
+      "is_custom": false, 
+      "name": "Authors", 
+      "link_column": "author", 
+      "column": "name", 
+      "label": "authors"
+    }
+  }, 
+  "tag_browser_hidden_categories": [], 
+  "bools_are_tristate": true, 
+  "library_view books view state": {
+    "hidden_columns": [
+      "last_modified", 
+      "languages"
+    ], 
+    "last_modified_injected": true, 
+    "column_sizes": {
+      "languages": 0, 
+      "rating": 63, 
+      "publisher": 78, 
+      "last_modified": 0, 
+      "timestamp": 64, 
+      "pubdate": 81, 
+      "title": 166, 
+      "size": 76, 
+      "series": 57, 
+      "authors": 77, 
+      "tags": 51
+    }, 
+    "sort_history": [
+      [
+        "timestamp", 
+        false
+      ], 
+      [
+        "last_modified", 
+        false
+      ], 
+      [
+        "ondevice", 
+        false
+      ], 
+      [
+        "timestamp", 
+        false
+      ]
+    ], 
+    "languages_injected": true, 
+    "column_positions": {
+      "languages": 11, 
+      "rating": 5, 
+      "ondevice": 0, 
+      "last_modified": 10, 
+      "timestamp": 3, 
+      "pubdate": 9, 
+      "title": 1, 
+      "size": 4, 
+      "series": 7, 
+      "authors": 2, 
+      "publisher": 8, 
+      "tags": 6
+    }, 
+    "column_alignment": {
+      "pubdate": "center", 
+      "size": "center", 
+      "timestamp": "center"
+    }
+  }, 
+  "grouped_search_terms": {}, 
+  "user_categories": {}, 
+  "books view split pane state": {
+    "hidden_columns": [], 
+    "column_positions": {
+      "languages": 11, 
+      "rating": 5, 
+      "ondevice": 0, 
+      "last_modified": 10, 
+      "timestamp": 3, 
+      "pubdate": 9, 
+      "title": 1, 
+      "tags": 6, 
+      "series": 7, 
+      "publisher": 8, 
+      "authors": 2, 
+      "size": 4
+    }, 
+    "column_sizes": {
+      "languages": 100, 
+      "rating": 100, 
+      "series": 100, 
+      "last_modified": 100, 
+      "timestamp": 100, 
+      "pubdate": 100, 
+      "title": 100, 
+      "size": 100, 
+      "publisher": 100, 
+      "authors": 100, 
+      "tags": 100
+    }
+  }
+}
\ No newline at end of file