summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-01-26 18:17:24 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-06-13 17:29:48 +0100
commit602a2bf28824becb3ffc718273fcbafb9fd1fc58 (patch)
tree70e45bff691751e11fde8fdd9e4a2542847a29ca
parentRemove unrequired templating of objectrowstate (diff)
downloadp2pvr-602a2bf28824becb3ffc718273fcbafb9fd1fc58.tar.bz2
p2pvr-602a2bf28824becb3ffc718273fcbafb9fd1fc58.tar.xz
p2pvr-602a2bf28824becb3ffc718273fcbafb9fd1fc58.zip
Add mock helper SQL for bringing test data into upcoming 7 days
-rw-r--r--p2pvr/daemon/unittests/datasources/eventOffset.sql8
-rw-r--r--p2pvr/daemon/unittests/mockDefs.cpp5
-rw-r--r--p2pvr/daemon/unittests/mockDefs.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/p2pvr/daemon/unittests/datasources/eventOffset.sql b/p2pvr/daemon/unittests/datasources/eventOffset.sql
new file mode 100644
index 0000000..3c796ca
--- /dev/null
+++ b/p2pvr/daemon/unittests/datasources/eventOffset.sql
@@ -0,0 +1,8 @@
+--
+-- This SQL will update events in the sample data to start today
+--
+
+UPDATE events SET
+ starttime = starttime + (SELECT current_date - min(starttime) FROM events),
+ stoptime = stoptime + (SELECT current_date - min(starttime) FROM events)
+
diff --git a/p2pvr/daemon/unittests/mockDefs.cpp b/p2pvr/daemon/unittests/mockDefs.cpp
index b488024..6974569 100644
--- a/p2pvr/daemon/unittests/mockDefs.cpp
+++ b/p2pvr/daemon/unittests/mockDefs.cpp
@@ -10,3 +10,8 @@ StandardMockDatabase::StandardMockDatabase() :
{
}
+StandardMockDatabasePlusOffset::StandardMockDatabasePlusOffset() :
+ MockDatabase("user=postgres dbname=postgres", "postgres", { "../../datasources/schema.sql", "datasources/data.sql", "datasources/eventOffset.sql" })
+{
+}
+
diff --git a/p2pvr/daemon/unittests/mockDefs.h b/p2pvr/daemon/unittests/mockDefs.h
index 2fa1e6f..69d2af9 100644
--- a/p2pvr/daemon/unittests/mockDefs.h
+++ b/p2pvr/daemon/unittests/mockDefs.h
@@ -7,6 +7,7 @@
DECLAREMOCK(SchemaOnlyMockDatabase);
DECLAREMOCK(StandardMockDatabase);
+DECLAREMOCK(StandardMockDatabasePlusOffset);
#undef DECLAREMOCK