fixed transaction test for updating and deleting
This commit is contained in:
parent
49e5e91860
commit
4ff3f07f9a
2 changed files with 39 additions and 3 deletions
|
@ -161,7 +161,7 @@ sub delete_recurring {
|
||||||
|
|
||||||
return $c->render( json => {
|
return $c->render( json => {
|
||||||
success => Mojo::JSON->true,
|
success => Mojo::JSON->true,
|
||||||
message => 'Recurring Transaction Delete Successfully',
|
message => 'Recurring Transaction Deleted Successfully',
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ my $session_key = $framework->login({
|
||||||
password => 'abc123',
|
password => 'abc123',
|
||||||
});
|
});
|
||||||
|
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
$t->post_ok('/api/outgoing-transactions' => json => {
|
$t->post_ok('/api/outgoing-transactions' => json => {
|
||||||
session_key => $session_key,
|
session_key => $session_key,
|
||||||
})
|
})
|
||||||
|
@ -50,6 +48,36 @@ $t->post_ok('/api/outgoing-transactions' => json => {
|
||||||
->json_has('/transactions/1/value')
|
->json_has('/transactions/1/value')
|
||||||
->json_has('/transactions/1/purchase_time');
|
->json_has('/transactions/1/purchase_time');
|
||||||
|
|
||||||
|
my $test_purchase_time = "2017-08-14T11:29:07.965+01:00";
|
||||||
|
|
||||||
|
$t->post_ok('/api/recurring-transactions' => json => {
|
||||||
|
session_key => $session_key,
|
||||||
|
id => 1,
|
||||||
|
apply_time => $test_purchase_time,
|
||||||
|
essential => "false",
|
||||||
|
value => 5,
|
||||||
|
recurring_period => 'daily',
|
||||||
|
})
|
||||||
|
->status_is(200)->or($framework->dump_error)
|
||||||
|
->json_is({
|
||||||
|
success => Mojo::JSON->true,
|
||||||
|
message => 'Recurring Transaction Updated Successfully',
|
||||||
|
});
|
||||||
|
|
||||||
|
is $schema->resultset('TransactionRecurring')->count, 87;
|
||||||
|
|
||||||
|
$t->post_ok('/api/recurring-transactions/delete' => json => {
|
||||||
|
session_key => $session_key,
|
||||||
|
id => 1,
|
||||||
|
})
|
||||||
|
->status_is(200)->or($framework->dump_error)
|
||||||
|
->json_is({
|
||||||
|
success => Mojo::JSON->true,
|
||||||
|
message => 'Recurring Transaction Deleted Successfully',
|
||||||
|
});
|
||||||
|
|
||||||
|
is $schema->resultset('TransactionRecurring')->count, 86;
|
||||||
|
|
||||||
|
|
||||||
sub create_random_transaction {
|
sub create_random_transaction {
|
||||||
my $buyer = shift;
|
my $buyer = shift;
|
||||||
|
@ -64,6 +92,14 @@ sub create_random_transaction {
|
||||||
proof_image => 'a',
|
proof_image => 'a',
|
||||||
purchase_time => $time,
|
purchase_time => $time,
|
||||||
});
|
});
|
||||||
|
$schema->resultset('TransactionRecurring')->create({
|
||||||
|
buyer => $buyer_result,
|
||||||
|
seller => $seller_result,
|
||||||
|
value => 10,
|
||||||
|
start_time => $time,
|
||||||
|
essential => 1,
|
||||||
|
recurring_period => 'weekly',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Reference in a new issue