[chronojump/chronojump-importer] Adds very simple integration test.
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/chronojump-importer] Adds very simple integration test.
- Date: Thu, 1 Sep 2016 21:11:47 +0000 (UTC)
commit f317963865b6404de240641cee8e7a685783cb4d
Author: Carles Pina i Estany <carles pina cat>
Date: Thu Sep 1 22:11:10 2016 +0100
Adds very simple integration test.
This will allow to refactor code and check that it keeps working.
...ronojump-importer.py => chronojump_importer.py} | 1 +
.../chronojump_importer_test.py | 35 ++++++++++++++++++++
src/chronojump-importer/tests/destination-a.sqlite | Bin 0 -> 55296 bytes
src/chronojump-importer/tests/expected-a.sqlite | Bin 0 -> 58368 bytes
src/chronojump-importer/tests/source-a.sqlite | Bin 0 -> 68608 bytes
5 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/chronojump-importer/chronojump-importer.py b/src/chronojump-importer/chronojump_importer.py
similarity index 99%
rename from src/chronojump-importer/chronojump-importer.py
rename to src/chronojump-importer/chronojump_importer.py
index a1d42b8..5c67d32 100755
--- a/src/chronojump-importer/chronojump-importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -2,6 +2,7 @@
import argparse
import sqlite3
+import sys
def results_delete_column(column, results):
diff --git a/src/chronojump-importer/chronojump_importer_test.py
b/src/chronojump-importer/chronojump_importer_test.py
new file mode 100755
index 0000000..5a57276
--- /dev/null
+++ b/src/chronojump-importer/chronojump_importer_test.py
@@ -0,0 +1,35 @@
+import unittest
+import chronojump_importer
+import os
+import subprocess
+import tempfile
+import shutil
+
+class TestImporter(unittest.TestCase):
+ def test_importerA(self):
+
+ temporary_directory_path = tempfile.mkdtemp(prefix="chronojump_importer_test_")
+
+ print("temporary directory path:", temporary_directory_path)
+
+ source_file = "{}/source-a.sqlite".format(temporary_directory_path)
+ destination_file = "{}/destination-a.sqlite".format(temporary_directory_path)
+
+ shutil.copy("/home/carles/git/chronojump/src/chronojump-importer/tests/source-a.sqlite", source_file)
+
+ shutil.copy("/home/carles/git/chronojump/src/chronojump-importer/tests/destination-a.sqlite",
destination_file)
+
+ command = "python3 ./chronojump_importer.py --source {} --destination {} --source_session
1".format(source_file, destination_file)
+
+ print("Command: ", command)
+ os.system(command)
+ os.system("echo .dump | sqlite3 {}/destination-a.sqlite >
{}/destination-a.sql".format(temporary_directory_path, temporary_directory_path))
+ os.system("echo .dump | sqlite3
/home/carles/git/chronojump/src/chronojump-importer/tests/expected-a.sqlite >
{}/expected-a.sql".format(temporary_directory_path))
+
+ diff = subprocess.getoutput("diff -u {}/destination-a.sql
{}/expected-a.sql".format(temporary_directory_path, temporary_directory_path))
+
+ self.maxDiff = None
+ self.assertEqual(diff, "")
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/src/chronojump-importer/tests/destination-a.sqlite
b/src/chronojump-importer/tests/destination-a.sqlite
new file mode 100644
index 0000000..cb9b622
Binary files /dev/null and b/src/chronojump-importer/tests/destination-a.sqlite differ
diff --git a/src/chronojump-importer/tests/expected-a.sqlite b/src/chronojump-importer/tests/expected-a.sqlite
new file mode 100644
index 0000000..e169c3e
Binary files /dev/null and b/src/chronojump-importer/tests/expected-a.sqlite differ
diff --git a/src/chronojump-importer/tests/source-a.sqlite b/src/chronojump-importer/tests/source-a.sqlite
new file mode 100644
index 0000000..a5bbd7b
Binary files /dev/null and b/src/chronojump-importer/tests/source-a.sqlite differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]