From cc046f517bc633fa5fd099544d99591dbc1635c0 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Fri, 25 Aug 2017 16:36:43 +0100 Subject: [PATCH] Added users fixture set --- t/etc/fixtures/config/users.pl | 97 +++++++++++++++++++ t/etc/fixtures/data/users/_config_set | 65 +++++++++++++ t/etc/fixtures/data/users/_dumper_version | 1 + t/etc/fixtures/data/users/customers/1.fix | 7 ++ t/etc/fixtures/data/users/customers/2.fix | 7 ++ t/etc/fixtures/data/users/customers/3.fix | 7 ++ t/etc/fixtures/data/users/customers/4.fix | 7 ++ t/etc/fixtures/data/users/leaderboards/1.fix | 5 + t/etc/fixtures/data/users/leaderboards/2.fix | 5 + t/etc/fixtures/data/users/leaderboards/3.fix | 5 + t/etc/fixtures/data/users/leaderboards/4.fix | 5 + t/etc/fixtures/data/users/leaderboards/5.fix | 5 + t/etc/fixtures/data/users/leaderboards/6.fix | 5 + t/etc/fixtures/data/users/leaderboards/7.fix | 5 + t/etc/fixtures/data/users/leaderboards/8.fix | 5 + t/etc/fixtures/data/users/organisations/1.fix | 10 ++ t/etc/fixtures/data/users/users/1.fix | 11 +++ t/etc/fixtures/data/users/users/2.fix | 11 +++ t/etc/fixtures/data/users/users/3.fix | 11 +++ t/etc/fixtures/data/users/users/4.fix | 11 +++ t/etc/fixtures/data/users/users/5.fix | 11 +++ 21 files changed, 296 insertions(+) create mode 100644 t/etc/fixtures/config/users.pl create mode 100644 t/etc/fixtures/data/users/_config_set create mode 100644 t/etc/fixtures/data/users/_dumper_version create mode 100644 t/etc/fixtures/data/users/customers/1.fix create mode 100644 t/etc/fixtures/data/users/customers/2.fix create mode 100644 t/etc/fixtures/data/users/customers/3.fix create mode 100644 t/etc/fixtures/data/users/customers/4.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/1.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/2.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/3.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/4.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/5.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/6.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/7.fix create mode 100644 t/etc/fixtures/data/users/leaderboards/8.fix create mode 100644 t/etc/fixtures/data/users/organisations/1.fix create mode 100644 t/etc/fixtures/data/users/users/1.fix create mode 100644 t/etc/fixtures/data/users/users/2.fix create mode 100644 t/etc/fixtures/data/users/users/3.fix create mode 100644 t/etc/fixtures/data/users/users/4.fix create mode 100644 t/etc/fixtures/data/users/users/5.fix diff --git a/t/etc/fixtures/config/users.pl b/t/etc/fixtures/config/users.pl new file mode 100644 index 0000000..676592b --- /dev/null +++ b/t/etc/fixtures/config/users.pl @@ -0,0 +1,97 @@ +#! /usr/bin/env perl + +use strict; +use warnings; + +use DBIx::Class::Fixtures; +use FindBin qw/ $Bin /; +use lib "$Bin/../../../../lib"; +use Pear::LocalLoop::Schema; +use DateTime; + +my $fixtures = DBIx::Class::Fixtures->new({ + config_dir => "$Bin", +}); + +my $schema = Pear::LocalLoop::Schema->connect('dbi:SQLite::memory:'); + +$schema->deploy; + +$schema->resultset('Leaderboard')->populate([ + [ qw/ name type / ], + [ 'Daily Total', 'daily_total' ], + [ 'Daily Count', 'daily_count' ], + [ 'Weekly Total', 'weekly_total' ], + [ 'Weekly Count', 'weekly_count' ], + [ 'Monthly Total', 'monthly_total' ], + [ 'Monthly Count', 'monthly_count' ], + [ 'All Time Total', 'all_time_total' ], + [ 'All Time Count', 'all_time_count' ], +]); + +my $user1 = { + customer => { + full_name => 'Test User1', + display_name => 'Test User1', + postcode => 'LA1 1AA', + year_of_birth => 2006, + }, + email => 'test1@example.com', + password => 'abc123', +}; + +my $user2 = { + customer => { + full_name => 'Test User2', + display_name => 'Test User2', + postcode => 'LA1 1AA', + year_of_birth => 2006, + }, + email => 'test2@example.com', + password => 'abc123', +}; + +my $user3 = { + customer => { + full_name => 'Test User3', + display_name => 'Test User3', + postcode => 'LA1 1AA', + year_of_birth => 2006, + }, + email => 'test3@example.com', + password => 'abc123', +}; + +my $user4 = { + customer => { + full_name => 'Test User4', + display_name => 'Test User4', + postcode => 'LA1 1AA', + year_of_birth => 2006, + }, + email => 'test4@example.com', + password => 'abc123', +}; + +my $org = { + organisation => { + name => 'Test Org', + street_name => 'Test Street', + town => 'Lancaster', + postcode => 'LA1 1AA', + }, + email => 'org@example.com', + password => 'abc123', +}; + +$schema->resultset('User')->create( $_ ) + for ( $user1, $user2, $user3, $user4, $org ); + +my $data_set = 'users'; + +$fixtures->dump({ + all => 1, + schema => $schema, + directory => "$Bin/../data/" . $data_set, +}); + diff --git a/t/etc/fixtures/data/users/_config_set b/t/etc/fixtures/data/users/_config_set new file mode 100644 index 0000000..f2242db --- /dev/null +++ b/t/etc/fixtures/data/users/_config_set @@ -0,0 +1,65 @@ +$VAR1 = { + 'has_many' => { + 'fetch' => 0 + }, + 'belongs_to' => { + 'fetch' => 0 + }, + 'might_have' => { + 'fetch' => 0 + }, + 'sets' => [ + { + 'class' => 'Leaderboard', + 'quantity' => 'all' + }, + { + 'class' => 'AccountToken', + 'quantity' => 'all' + }, + { + 'class' => 'LeaderboardValue', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'SessionToken' + }, + { + 'class' => 'Administrator', + 'quantity' => 'all' + }, + { + 'class' => 'LeaderboardSet', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'Feedback' + }, + { + 'class' => 'PendingOrganisation', + 'quantity' => 'all' + }, + { + 'class' => 'User', + 'quantity' => 'all' + }, + { + 'class' => 'Transaction', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'Organisation' + }, + { + 'quantity' => 'all', + 'class' => 'Customer' + }, + { + 'quantity' => 'all', + 'class' => 'PendingTransaction' + } + ] + }; diff --git a/t/etc/fixtures/data/users/_dumper_version b/t/etc/fixtures/data/users/_dumper_version new file mode 100644 index 0000000..8d0321e --- /dev/null +++ b/t/etc/fixtures/data/users/_dumper_version @@ -0,0 +1 @@ +1.001036 \ No newline at end of file diff --git a/t/etc/fixtures/data/users/customers/1.fix b/t/etc/fixtures/data/users/customers/1.fix new file mode 100644 index 0000000..16d0da6 --- /dev/null +++ b/t/etc/fixtures/data/users/customers/1.fix @@ -0,0 +1,7 @@ +$HASH1 = { + display_name => 'Test User1', + full_name => 'Test User1', + id => 1, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/users/customers/2.fix b/t/etc/fixtures/data/users/customers/2.fix new file mode 100644 index 0000000..3c31701 --- /dev/null +++ b/t/etc/fixtures/data/users/customers/2.fix @@ -0,0 +1,7 @@ +$HASH1 = { + display_name => 'Test User2', + full_name => 'Test User2', + id => 2, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/users/customers/3.fix b/t/etc/fixtures/data/users/customers/3.fix new file mode 100644 index 0000000..b434d5c --- /dev/null +++ b/t/etc/fixtures/data/users/customers/3.fix @@ -0,0 +1,7 @@ +$HASH1 = { + display_name => 'Test User3', + full_name => 'Test User3', + id => 3, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/users/customers/4.fix b/t/etc/fixtures/data/users/customers/4.fix new file mode 100644 index 0000000..d5f881b --- /dev/null +++ b/t/etc/fixtures/data/users/customers/4.fix @@ -0,0 +1,7 @@ +$HASH1 = { + display_name => 'Test User4', + full_name => 'Test User4', + id => 4, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/users/leaderboards/1.fix b/t/etc/fixtures/data/users/leaderboards/1.fix new file mode 100644 index 0000000..597a843 --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/1.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 1, + name => 'Daily Total', + type => 'daily_total' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/2.fix b/t/etc/fixtures/data/users/leaderboards/2.fix new file mode 100644 index 0000000..08fef2c --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/2.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 2, + name => 'Daily Count', + type => 'daily_count' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/3.fix b/t/etc/fixtures/data/users/leaderboards/3.fix new file mode 100644 index 0000000..4166f18 --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/3.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 3, + name => 'Weekly Total', + type => 'weekly_total' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/4.fix b/t/etc/fixtures/data/users/leaderboards/4.fix new file mode 100644 index 0000000..feb773c --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/4.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 4, + name => 'Weekly Count', + type => 'weekly_count' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/5.fix b/t/etc/fixtures/data/users/leaderboards/5.fix new file mode 100644 index 0000000..d0522b2 --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/5.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 5, + name => 'Monthly Total', + type => 'monthly_total' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/6.fix b/t/etc/fixtures/data/users/leaderboards/6.fix new file mode 100644 index 0000000..f7bb145 --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/6.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 6, + name => 'Monthly Count', + type => 'monthly_count' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/7.fix b/t/etc/fixtures/data/users/leaderboards/7.fix new file mode 100644 index 0000000..b2aadcd --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/7.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 7, + name => 'All Time Total', + type => 'all_time_total' + }; diff --git a/t/etc/fixtures/data/users/leaderboards/8.fix b/t/etc/fixtures/data/users/leaderboards/8.fix new file mode 100644 index 0000000..df58698 --- /dev/null +++ b/t/etc/fixtures/data/users/leaderboards/8.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 8, + name => 'All Time Count', + type => 'all_time_count' + }; diff --git a/t/etc/fixtures/data/users/organisations/1.fix b/t/etc/fixtures/data/users/organisations/1.fix new file mode 100644 index 0000000..035a3ce --- /dev/null +++ b/t/etc/fixtures/data/users/organisations/1.fix @@ -0,0 +1,10 @@ +$HASH1 = { + id => 1, + name => 'Test Org', + postcode + => 'LA1 1AA', + sector => undef, + street_name + => 'Test Street', + town => 'Lancaster' + }; diff --git a/t/etc/fixtures/data/users/users/1.fix b/t/etc/fixtures/data/users/users/1.fix new file mode 100644 index 0000000..0946374 --- /dev/null +++ b/t/etc/fixtures/data/users/users/1.fix @@ -0,0 +1,11 @@ +$HASH1 = { + customer_id + => 1, + email => 'test1@example.com', + id => 1, + join_date + => '2017-08-25 15:36:11', + organisation_id + => undef, + password => '$2a$08$yCau6xDkRFZINg80iVvMh.M3JnLq2g.LJ7GMJL5KQvO45pDL.D/Rq' + }; diff --git a/t/etc/fixtures/data/users/users/2.fix b/t/etc/fixtures/data/users/users/2.fix new file mode 100644 index 0000000..9b35ef4 --- /dev/null +++ b/t/etc/fixtures/data/users/users/2.fix @@ -0,0 +1,11 @@ +$HASH1 = { + customer_id + => 2, + email => 'test2@example.com', + id => 2, + join_date + => '2017-08-25 15:36:11', + organisation_id + => undef, + password => '$2a$08$BZAsbHSW8TN/jlL2DFGDoeKFRKzj2dQTBwatxb0p/maefEcWcziom' + }; diff --git a/t/etc/fixtures/data/users/users/3.fix b/t/etc/fixtures/data/users/users/3.fix new file mode 100644 index 0000000..f3ad391 --- /dev/null +++ b/t/etc/fixtures/data/users/users/3.fix @@ -0,0 +1,11 @@ +$HASH1 = { + customer_id + => 3, + email => 'test3@example.com', + id => 3, + join_date + => '2017-08-25 15:36:11', + organisation_id + => undef, + password => '$2a$08$xdkD/OA5izrOX9cvJDa4i..8T3YGmfVSo/G87wDRoGWnQmlC0gxOW' + }; diff --git a/t/etc/fixtures/data/users/users/4.fix b/t/etc/fixtures/data/users/users/4.fix new file mode 100644 index 0000000..47d83c3 --- /dev/null +++ b/t/etc/fixtures/data/users/users/4.fix @@ -0,0 +1,11 @@ +$HASH1 = { + customer_id + => 4, + email => 'test4@example.com', + id => 4, + join_date + => '2017-08-25 15:36:11', + organisation_id + => undef, + password => '$2a$08$svjdm.Syn3f062pDIN3/ROTUU7W16n0zJFm9/sm3x7pfbMLZFV.5G' + }; diff --git a/t/etc/fixtures/data/users/users/5.fix b/t/etc/fixtures/data/users/users/5.fix new file mode 100644 index 0000000..50e56c9 --- /dev/null +++ b/t/etc/fixtures/data/users/users/5.fix @@ -0,0 +1,11 @@ +$HASH1 = { + customer_id + => undef, + email => 'org@example.com', + id => 5, + join_date + => '2017-08-25 15:36:11', + organisation_id + => 1, + password => '$2a$08$3PkZF7D9FiOq8hgU7cJ6puY86Fkl34bQj6dZeJRXPU8hhJIMZtge2' + };