From d4ccd0b7a2f15e4191084af01fca02ce88ded4bb Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 31 Aug 2017 13:18:04 +0100 Subject: [PATCH] Update user fixtures with new entity code --- t/etc/fixtures/config/users.pl | 82 +++++++++++++------ t/etc/fixtures/data/users/_config_set | 42 ++++------ t/etc/fixtures/data/users/customers/1.fix | 1 + t/etc/fixtures/data/users/customers/2.fix | 1 + t/etc/fixtures/data/users/customers/3.fix | 1 + t/etc/fixtures/data/users/customers/4.fix | 1 + t/etc/fixtures/data/users/customers/5.fix | 8 ++ t/etc/fixtures/data/users/entities/1.fix | 4 + t/etc/fixtures/data/users/entities/2.fix | 4 + t/etc/fixtures/data/users/entities/3.fix | 4 + t/etc/fixtures/data/users/entities/4.fix | 4 + t/etc/fixtures/data/users/entities/5.fix | 4 + t/etc/fixtures/data/users/entities/6.fix | 4 + t/etc/fixtures/data/users/organisations/1.fix | 18 ++-- t/etc/fixtures/data/users/users/1.fix | 15 ++-- t/etc/fixtures/data/users/users/2.fix | 15 ++-- t/etc/fixtures/data/users/users/3.fix | 15 ++-- t/etc/fixtures/data/users/users/4.fix | 15 ++-- t/etc/fixtures/data/users/users/5.fix | 15 ++-- t/etc/fixtures/data/users/users/6.fix | 8 ++ 20 files changed, 159 insertions(+), 102 deletions(-) create mode 100644 t/etc/fixtures/data/users/customers/5.fix create mode 100644 t/etc/fixtures/data/users/entities/1.fix create mode 100644 t/etc/fixtures/data/users/entities/2.fix create mode 100644 t/etc/fixtures/data/users/entities/3.fix create mode 100644 t/etc/fixtures/data/users/entities/4.fix create mode 100644 t/etc/fixtures/data/users/entities/5.fix create mode 100644 t/etc/fixtures/data/users/entities/6.fix create mode 100644 t/etc/fixtures/data/users/users/6.fix diff --git a/t/etc/fixtures/config/users.pl b/t/etc/fixtures/config/users.pl index 676592b..88d3066 100644 --- a/t/etc/fixtures/config/users.pl +++ b/t/etc/fixtures/config/users.pl @@ -29,63 +29,93 @@ $schema->resultset('Leaderboard')->populate([ [ 'All Time Count', 'all_time_count' ], ]); -my $user1 = { +my $entity1 = { customer => { full_name => 'Test User1', display_name => 'Test User1', postcode => 'LA1 1AA', year_of_birth => 2006, }, - email => 'test1@example.com', - password => 'abc123', + user => { + email => 'test1@example.com', + password => 'abc123', + }, + type => "customer", }; -my $user2 = { +my $entity2 = { customer => { - full_name => 'Test User2', - display_name => 'Test User2', - postcode => 'LA1 1AA', + full_name => 'Test User2', + display_name => 'Test User2', + postcode => 'LA1 1AA', year_of_birth => 2006, }, - email => 'test2@example.com', - password => 'abc123', + user => { + email => 'test2@example.com', + password => 'abc123', + }, + type => "customer", }; -my $user3 = { +my $entity3 = { customer => { - full_name => 'Test User3', - display_name => 'Test User3', - postcode => 'LA1 1AA', + full_name => 'Test User3', + display_name => 'Test User3', + postcode => 'LA1 1AA', year_of_birth => 2006, }, - email => 'test3@example.com', - password => 'abc123', + user => { + email => 'test3@example.com', + password => 'abc123', + }, + type => "customer", }; -my $user4 = { +my $entity4 = { customer => { - full_name => 'Test User4', - display_name => 'Test User4', - postcode => 'LA1 1AA', + full_name => 'Test User4', + display_name => 'Test User4', + postcode => 'LA1 1AA', year_of_birth => 2006, }, - email => 'test4@example.com', - password => 'abc123', + user => { + email => 'test4@example.com', + password => 'abc123', + }, + type => "customer", }; -my $org = { +my $entity5 = { organisation => { name => 'Test Org', street_name => 'Test Street', town => 'Lancaster', postcode => 'LA1 1AA', }, - email => 'org@example.com', - password => 'abc123', + user => { + email => 'org@example.com', + password => 'abc123', + }, + type => "customer", }; -$schema->resultset('User')->create( $_ ) - for ( $user1, $user2, $user3, $user4, $org ); +my $entity6 = { + customer => { + full_name => 'Test Admin', + display_name => 'Test Admin', + postcode => 'LA1 1AA', + year_of_birth => 2006, + }, + user => { + email => 'admin@example.com', + password => 'abc123', + is_admin => \"1", + }, + type => "customer", +}; + +$schema->resultset('Entity')->create( $_ ) + for ( $entity1, $entity2, $entity3, $entity4, $entity5, $entity6 ); my $data_set = 'users'; diff --git a/t/etc/fixtures/data/users/_config_set b/t/etc/fixtures/data/users/_config_set index f2242db..debc83c 100644 --- a/t/etc/fixtures/data/users/_config_set +++ b/t/etc/fixtures/data/users/_config_set @@ -5,20 +5,21 @@ $VAR1 = { 'belongs_to' => { 'fetch' => 0 }, - 'might_have' => { - 'fetch' => 0 - }, 'sets' => [ { - 'class' => 'Leaderboard', + 'class' => 'Feedback', 'quantity' => 'all' }, { - 'class' => 'AccountToken', + 'quantity' => 'all', + 'class' => 'LeaderboardSet' + }, + { + 'class' => 'Transaction', 'quantity' => 'all' }, { - 'class' => 'LeaderboardValue', + 'class' => 'Entity', 'quantity' => 'all' }, { @@ -26,40 +27,31 @@ $VAR1 = { 'class' => 'SessionToken' }, { - 'class' => 'Administrator', + 'class' => 'AccountToken', 'quantity' => 'all' }, { - 'class' => 'LeaderboardSet', + 'class' => 'Organisation', 'quantity' => 'all' }, { 'quantity' => 'all', - 'class' => 'Feedback' + 'class' => 'User' }, { - 'class' => 'PendingOrganisation', + 'class' => 'Customer', 'quantity' => 'all' }, { - 'class' => 'User', - 'quantity' => 'all' - }, - { - 'class' => 'Transaction', + 'class' => 'Leaderboard', 'quantity' => 'all' }, { 'quantity' => 'all', - 'class' => 'Organisation' - }, - { - 'quantity' => 'all', - 'class' => 'Customer' - }, - { - 'quantity' => 'all', - 'class' => 'PendingTransaction' + 'class' => 'LeaderboardValue' } - ] + ], + 'might_have' => { + 'fetch' => 0 + } }; diff --git a/t/etc/fixtures/data/users/customers/1.fix b/t/etc/fixtures/data/users/customers/1.fix index 16d0da6..705c22d 100644 --- a/t/etc/fixtures/data/users/customers/1.fix +++ b/t/etc/fixtures/data/users/customers/1.fix @@ -1,5 +1,6 @@ $HASH1 = { display_name => 'Test User1', + entity_id => 1, full_name => 'Test User1', id => 1, postcode => 'LA1 1AA', diff --git a/t/etc/fixtures/data/users/customers/2.fix b/t/etc/fixtures/data/users/customers/2.fix index 3c31701..0fee4aa 100644 --- a/t/etc/fixtures/data/users/customers/2.fix +++ b/t/etc/fixtures/data/users/customers/2.fix @@ -1,5 +1,6 @@ $HASH1 = { display_name => 'Test User2', + entity_id => 2, full_name => 'Test User2', id => 2, postcode => 'LA1 1AA', diff --git a/t/etc/fixtures/data/users/customers/3.fix b/t/etc/fixtures/data/users/customers/3.fix index b434d5c..a64e402 100644 --- a/t/etc/fixtures/data/users/customers/3.fix +++ b/t/etc/fixtures/data/users/customers/3.fix @@ -1,5 +1,6 @@ $HASH1 = { display_name => 'Test User3', + entity_id => 3, full_name => 'Test User3', id => 3, postcode => 'LA1 1AA', diff --git a/t/etc/fixtures/data/users/customers/4.fix b/t/etc/fixtures/data/users/customers/4.fix index d5f881b..49d0530 100644 --- a/t/etc/fixtures/data/users/customers/4.fix +++ b/t/etc/fixtures/data/users/customers/4.fix @@ -1,5 +1,6 @@ $HASH1 = { display_name => 'Test User4', + entity_id => 4, full_name => 'Test User4', id => 4, postcode => 'LA1 1AA', diff --git a/t/etc/fixtures/data/users/customers/5.fix b/t/etc/fixtures/data/users/customers/5.fix new file mode 100644 index 0000000..50ef1c2 --- /dev/null +++ b/t/etc/fixtures/data/users/customers/5.fix @@ -0,0 +1,8 @@ +$HASH1 = { + display_name => 'Test Admin', + entity_id => 6, + full_name => 'Test Admin', + id => 5, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/users/entities/1.fix b/t/etc/fixtures/data/users/entities/1.fix new file mode 100644 index 0000000..a45e065 --- /dev/null +++ b/t/etc/fixtures/data/users/entities/1.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 1, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/users/entities/2.fix b/t/etc/fixtures/data/users/entities/2.fix new file mode 100644 index 0000000..20849e3 --- /dev/null +++ b/t/etc/fixtures/data/users/entities/2.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 2, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/users/entities/3.fix b/t/etc/fixtures/data/users/entities/3.fix new file mode 100644 index 0000000..3fd6a9a --- /dev/null +++ b/t/etc/fixtures/data/users/entities/3.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 3, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/users/entities/4.fix b/t/etc/fixtures/data/users/entities/4.fix new file mode 100644 index 0000000..bacb15b --- /dev/null +++ b/t/etc/fixtures/data/users/entities/4.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 4, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/users/entities/5.fix b/t/etc/fixtures/data/users/entities/5.fix new file mode 100644 index 0000000..e22cd57 --- /dev/null +++ b/t/etc/fixtures/data/users/entities/5.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 5, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/users/entities/6.fix b/t/etc/fixtures/data/users/entities/6.fix new file mode 100644 index 0000000..ee9f57f --- /dev/null +++ b/t/etc/fixtures/data/users/entities/6.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 6, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/users/organisations/1.fix b/t/etc/fixtures/data/users/organisations/1.fix index 035a3ce..b761450 100644 --- a/t/etc/fixtures/data/users/organisations/1.fix +++ b/t/etc/fixtures/data/users/organisations/1.fix @@ -1,10 +1,16 @@ $HASH1 = { - id => 1, - name => 'Test Org', + country => undef, + entity_id + => 5, + id => 1, + name => 'Test Org', + pending => 0, postcode - => 'LA1 1AA', - sector => undef, + => 'LA1 1AA', + sector => undef, street_name - => 'Test Street', - town => 'Lancaster' + => 'Test Street', + submitted_by_id + => undef, + town => 'Lancaster' }; diff --git a/t/etc/fixtures/data/users/users/1.fix b/t/etc/fixtures/data/users/users/1.fix index 0946374..9507717 100644 --- a/t/etc/fixtures/data/users/users/1.fix +++ b/t/etc/fixtures/data/users/users/1.fix @@ -1,11 +1,8 @@ $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' + email => 'test1@example.com', + entity_id => 1, + id => 1, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$HSuznDeSU1fuONwKhp2/S.TX/X4p4g0dHtz20kVXxprm8hIg5QQma' }; diff --git a/t/etc/fixtures/data/users/users/2.fix b/t/etc/fixtures/data/users/users/2.fix index 9b35ef4..9654ada 100644 --- a/t/etc/fixtures/data/users/users/2.fix +++ b/t/etc/fixtures/data/users/users/2.fix @@ -1,11 +1,8 @@ $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' + email => 'test2@example.com', + entity_id => 2, + id => 2, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$5XYLWPJvVGuWUvfSWj9cIOg4/tyB4fZ3knzwgw5UnBSKFBFIKOiFC' }; diff --git a/t/etc/fixtures/data/users/users/3.fix b/t/etc/fixtures/data/users/users/3.fix index f3ad391..fd07648 100644 --- a/t/etc/fixtures/data/users/users/3.fix +++ b/t/etc/fixtures/data/users/users/3.fix @@ -1,11 +1,8 @@ $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' + email => 'test3@example.com', + entity_id => 3, + id => 3, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$p5VU4leHetEvuz2P3uMfYuuPTkDGg8wsM7QuSVKkXR.s3B9T2JaVW' }; diff --git a/t/etc/fixtures/data/users/users/4.fix b/t/etc/fixtures/data/users/users/4.fix index 47d83c3..e8300ec 100644 --- a/t/etc/fixtures/data/users/users/4.fix +++ b/t/etc/fixtures/data/users/users/4.fix @@ -1,11 +1,8 @@ $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' + email => 'test4@example.com', + entity_id => 4, + id => 4, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$fkkTUYA9zvt32iBbN7aOcOnmiHzOkbMEjN31PB9CsitGrE.KF7cAG' }; diff --git a/t/etc/fixtures/data/users/users/5.fix b/t/etc/fixtures/data/users/users/5.fix index 50e56c9..97859de 100644 --- a/t/etc/fixtures/data/users/users/5.fix +++ b/t/etc/fixtures/data/users/users/5.fix @@ -1,11 +1,8 @@ $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' + email => 'org@example.com', + entity_id => 5, + id => 5, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$MWC45.w1AnLPNNHiS96ICOHfNlTrIqB0.7OPzy5qB.z0pZB0theo.' }; diff --git a/t/etc/fixtures/data/users/users/6.fix b/t/etc/fixtures/data/users/users/6.fix new file mode 100644 index 0000000..d1b52dc --- /dev/null +++ b/t/etc/fixtures/data/users/users/6.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'admin@example.com', + entity_id => 6, + id => 6, + is_admin => 1, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$1sPcPB9GnoNgzhBAk2bHSOqEmv6.Y6YLrAa2DJ6TR2WefzTYZQ92G' + };