From f68479b5acfee9f437db42d5a1806707a1e67b91 Mon Sep 17 00:00:00 2001 From: Finn Date: Mon, 27 Nov 2017 17:16:22 +0000 Subject: [PATCH] extra info fixed and test amended and fixtures changed --- .../Controller/Api/V1/Supplier/Location.pm | 3 + t/api/v1/supplier/location.t | 3 + t/etc/fixtures/config/full.pl | 12 ++- t/etc/fixtures/data/full/_config_set | 92 ++++++++++++------- .../data/full/entity_association/1.fix | 6 ++ .../data/full/gb_postcodes/LA2-0AA.fix | 2 +- t/etc/fixtures/data/full/organisations/1.fix | 1 + t/etc/fixtures/data/full/organisations/2.fix | 1 + 8 files changed, 80 insertions(+), 40 deletions(-) create mode 100644 t/etc/fixtures/data/full/entity_association/1.fix diff --git a/lib/Pear/LocalLoop/Controller/Api/V1/Supplier/Location.pm b/lib/Pear/LocalLoop/Controller/Api/V1/Supplier/Location.pm index 2ca7ebc..9ffb0d4 100644 --- a/lib/Pear/LocalLoop/Controller/Api/V1/Supplier/Location.pm +++ b/lib/Pear/LocalLoop/Controller/Api/V1/Supplier/Location.pm @@ -79,6 +79,9 @@ sub index { 'organisation.name', 'organisation.latitude', 'organisation.longitude', + 'organisation.street_name', + 'organisation.town', + 'organisation.postcode', ], group_by => [ qw/ organisation.id / ], }, diff --git a/t/api/v1/supplier/location.t b/t/api/v1/supplier/location.t index 7b7794a..89b277a 100644 --- a/t/api/v1/supplier/location.t +++ b/t/api/v1/supplier/location.t @@ -49,6 +49,9 @@ $t->post_ok('/api/v1/supplier/location' => json => { name => 'Test Org 2', latitude => 54.04679, longitude => -2.7963, + street_name => 'Test Street', + town => 'Lancaster', + postcode => 'LA1 1AG', }, ]) ->json_is('/self', { diff --git a/t/etc/fixtures/config/full.pl b/t/etc/fixtures/config/full.pl index 61c9c5e..c1959cb 100644 --- a/t/etc/fixtures/config/full.pl +++ b/t/etc/fixtures/config/full.pl @@ -99,8 +99,8 @@ my $org1 = { street_name => 'Test Street', town => 'Lancaster', postcode => 'LA1 1AF', - latitude => 54.04725, - longitude => -2.79611, + latitude => 54.04725, + longitude => -2.79611, }, user => { email => 'org1@example.com', @@ -115,13 +115,16 @@ my $org2 = { street_name => 'Test Street', town => 'Lancaster', postcode => 'LA1 1AG', - latitude => 54.04679, - longitude => -2.7963, + latitude => 54.04679, + longitude => -2.7963, }, user => { email => 'org2@example.com', password => 'abc123', }, + associations => { + lis => 1, + }, type => "organisation", }; @@ -207,4 +210,3 @@ $fixtures->dump({ schema => $schema, directory => "$Bin/../data/" . $data_set, }); - diff --git a/t/etc/fixtures/data/full/_config_set b/t/etc/fixtures/data/full/_config_set index bc4099f..d2fde35 100644 --- a/t/etc/fixtures/data/full/_config_set +++ b/t/etc/fixtures/data/full/_config_set @@ -2,64 +2,88 @@ $VAR1 = { 'has_many' => { 'fetch' => 0 }, + 'belongs_to' => { + 'fetch' => 0 + }, + 'might_have' => { + 'fetch' => 0 + }, 'sets' => [ + { + 'class' => 'EntityAssociation', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'ViewQuantisedTransactionPg' + }, { 'class' => 'OrganisationPayroll', 'quantity' => 'all' }, - { - 'quantity' => 'all', - 'class' => 'User' - }, - { - 'quantity' => 'all', - 'class' => 'Customer' - }, - { - 'class' => 'Entity', - 'quantity' => 'all' - }, - { - 'quantity' => 'all', - 'class' => 'LeaderboardValue' - }, { 'quantity' => 'all', 'class' => 'Feedback' }, { - 'class' => 'Organisation', - 'quantity' => 'all' - }, - { - 'class' => 'GbPostcode', + 'class' => 'LeaderboardValue', 'quantity' => 'all' }, { 'quantity' => 'all', - 'class' => 'LeaderboardSet' - }, - { - 'quantity' => 'all', - 'class' => 'AccountToken' + 'class' => 'GbPostcode' }, { 'quantity' => 'all', 'class' => 'SessionToken' }, + { + 'quantity' => 'all', + 'class' => 'ViewQuantisedTransactionSQLite' + }, + { + 'class' => 'LeaderboardSet', + 'quantity' => 'all' + }, + { + 'class' => 'ImportSet', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'ImportValue' + }, + { + 'class' => 'AccountToken', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'Leaderboard' + }, { 'quantity' => 'all', 'class' => 'Transaction' }, { - 'class' => 'Leaderboard', + 'quantity' => 'all', + 'class' => 'Organisation' + }, + { + 'class' => 'Customer', 'quantity' => 'all' + }, + { + 'class' => 'ImportLookup', + 'quantity' => 'all' + }, + { + 'class' => 'Entity', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'User' } - ], - 'belongs_to' => { - 'fetch' => 0 - }, - 'might_have' => { - 'fetch' => 0 - } + ] }; diff --git a/t/etc/fixtures/data/full/entity_association/1.fix b/t/etc/fixtures/data/full/entity_association/1.fix new file mode 100644 index 0000000..47c930a --- /dev/null +++ b/t/etc/fixtures/data/full/entity_association/1.fix @@ -0,0 +1,6 @@ +$HASH1 = { + entity_id + => 6, + id => 1, + lis => 1 + }; diff --git a/t/etc/fixtures/data/full/gb_postcodes/LA2-0AA.fix b/t/etc/fixtures/data/full/gb_postcodes/LA2-0AA.fix index 3b6c044..7009876 100644 --- a/t/etc/fixtures/data/full/gb_postcodes/LA2-0AA.fix +++ b/t/etc/fixtures/data/full/gb_postcodes/LA2-0AA.fix @@ -1,6 +1,6 @@ $HASH1 = { incode => '0AA', latitude => 54.02493, - longitude => -2.80717, + longitude => -2.80718, outcode => 'LA2' }; diff --git a/t/etc/fixtures/data/full/organisations/1.fix b/t/etc/fixtures/data/full/organisations/1.fix index b9ce32d..21968dd 100644 --- a/t/etc/fixtures/data/full/organisations/1.fix +++ b/t/etc/fixtures/data/full/organisations/1.fix @@ -3,6 +3,7 @@ $HASH1 = { entity_id => 5, id => 1, + is_local => undef, latitude => 54.04725, longitude => -2.79611, diff --git a/t/etc/fixtures/data/full/organisations/2.fix b/t/etc/fixtures/data/full/organisations/2.fix index 8702817..631eea2 100644 --- a/t/etc/fixtures/data/full/organisations/2.fix +++ b/t/etc/fixtures/data/full/organisations/2.fix @@ -3,6 +3,7 @@ $HASH1 = { entity_id => 6, id => 2, + is_local => undef, latitude => 54.04679, longitude => -2.7963,