From 5a8b5ecc2d3d5a7f86c32899ac596c1863a7ce45 Mon Sep 17 00:00:00 2001
From: Paul Dill
Date: Wed, 8 Mar 2017 18:52:04 +0000
Subject: [PATCH] Update config and tests so deployment and testing use
separate databases.
---
pear-local_loop.development.conf | 2 +-
pear-local_loop.testing.conf | 6 ++++++
t/admin-approve.t | 6 ++++--
t/admin-merge.t | 8 +++++---
t/basic.t | 6 ++++++
t/login.t | 6 ++++--
t/register.t | 6 ++++--
t/search.t | 6 ++++--
t/upload.t | 6 ++++--
9 files changed, 38 insertions(+), 14 deletions(-)
create mode 100644 pear-local_loop.testing.conf
diff --git a/pear-local_loop.development.conf b/pear-local_loop.development.conf
index 2add266..6810316 100644
--- a/pear-local_loop.development.conf
+++ b/pear-local_loop.development.conf
@@ -1,5 +1,5 @@
{
- dsn => "dbi:SQLite:dbname=foodloop-test.db",
+ dsn => "dbi:SQLite:dbname=foodloop.db",
user => undef,
pass => undef,
key => "a",
diff --git a/pear-local_loop.testing.conf b/pear-local_loop.testing.conf
new file mode 100644
index 0000000..2add266
--- /dev/null
+++ b/pear-local_loop.testing.conf
@@ -0,0 +1,6 @@
+{
+ dsn => "dbi:SQLite:dbname=foodloop-test.db",
+ user => undef,
+ pass => undef,
+ key => "a",
+};
diff --git a/t/admin-approve.t b/t/admin-approve.t
index fbace4c..e097323 100644
--- a/t/admin-approve.t
+++ b/t/admin-approve.t
@@ -4,8 +4,10 @@ use Mojo::JSON;
use FindBin;
-$ENV{MOJO_MODE} = 'development';
-$ENV{MOJO_LOG_LEVEL} = 'debug';
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
my $t = Test::Mojo->new("Pear::LocalLoop");
diff --git a/t/admin-merge.t b/t/admin-merge.t
index 2577d33..26007a8 100644
--- a/t/admin-merge.t
+++ b/t/admin-merge.t
@@ -4,8 +4,10 @@ use Mojo::JSON;
use FindBin;
-$ENV{MOJO_MODE} = 'development';
-$ENV{MOJO_LOG_LEVEL} = 'debug';
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
my $t = Test::Mojo->new("Pear::LocalLoop");
@@ -29,7 +31,7 @@ foreach (@accountTokens){
}
-#This depends on "register.t", "login.t" and "upload.t" working.
+#This depends on "register.t", "login.t", "upload.t" and "admin-approve.t" working.
#Valid customer, this also tests that redirects are disabled for register.
print "test 1 - Create customer user account (Reno)\n";
diff --git a/t/basic.t b/t/basic.t
index c0c82aa..4ebc38d 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -2,6 +2,12 @@ use Test::More;
use Test::Mojo;
use FindBin;
+
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
+
my $t = Test::Mojo->new("Pear::LocalLoop");
$t->get_ok('/login')->status_is(200)->content_like(qr/login page/);
diff --git a/t/login.t b/t/login.t
index f4f7fd0..b2d6525 100644
--- a/t/login.t
+++ b/t/login.t
@@ -5,8 +5,10 @@ use Time::Fake;
use FindBin;
-$ENV{MOJO_MODE} = 'development';
-$ENV{MOJO_LOG_LEVEL} = 'debug';
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
my $t = Test::Mojo->new("Pear::LocalLoop");
diff --git a/t/register.t b/t/register.t
index e49ece9..f6b0616 100644
--- a/t/register.t
+++ b/t/register.t
@@ -4,8 +4,10 @@ use Mojo::JSON;
use FindBin;
-$ENV{MOJO_MODE} = 'development';
-$ENV{MOJO_LOG_LEVEL} = 'debug';
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
my $t = Test::Mojo->new("Pear::LocalLoop");
diff --git a/t/search.t b/t/search.t
index 97fe477..6c7b4dd 100644
--- a/t/search.t
+++ b/t/search.t
@@ -6,8 +6,10 @@ use Text::ParseWords;
use FindBin;
-$ENV{MOJO_MODE} = 'development';
-$ENV{MOJO_LOG_LEVEL} = 'debug';
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
my $t = Test::Mojo->new("Pear::LocalLoop");
diff --git a/t/upload.t b/t/upload.t
index ba61091..c3670dd 100644
--- a/t/upload.t
+++ b/t/upload.t
@@ -4,8 +4,10 @@ use Mojo::JSON;
use FindBin;
-$ENV{MOJO_MODE} = 'development';
-$ENV{MOJO_LOG_LEVEL} = 'debug';
+BEGIN {
+ $ENV{MOJO_MODE} = 'testing';
+ $ENV{MOJO_LOG_LEVEL} = 'debug';
+}
my $t = Test::Mojo->new("Pear::LocalLoop");