From cca27b547531100f006ac2bd29b8b163cea4f5a3 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 31 Aug 2017 19:12:13 +0100 Subject: [PATCH] Fix org graphs test for entity upgrade --- lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm | 2 +- t/api/v1/organisation/graphs.t | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm b/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm index bb807ba..bc78d91 100644 --- a/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm +++ b/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm @@ -56,7 +56,7 @@ sub graph_customers_last_30_days { sub _customers_last_duration { my ( $c, $duration ) = @_; - my $org = $c->stash->{api_user}->organisation; + my $org = $c->stash->{api_user}->entity; my $data = { day => [], count => [] }; diff --git a/t/api/v1/organisation/graphs.t b/t/api/v1/organisation/graphs.t index d6885f3..c5ee6f9 100644 --- a/t/api/v1/organisation/graphs.t +++ b/t/api/v1/organisation/graphs.t @@ -77,9 +77,11 @@ sub create_random_transaction { my $buyer = shift; my $time = shift; + my $buyer_result = $schema->resultset('User')->find({ email => $buyer })->entity; + my $seller_result = $schema->resultset('Organisation')->find({ name => 'Test Org' })->entity; $schema->resultset('Transaction')->create({ - buyer => { email => $buyer }, - seller => { name => 'Test Org' }, + buyer => $buyer_result, + seller => $seller_result, value => ( int( rand( 10000 ) ) / 100 ), proof_image => 'a', purchase_time => $time,