Tests fixed adding for category
This commit is contained in:
parent
85a9647294
commit
ace66d0447
2 changed files with 18 additions and 2 deletions
|
@ -35,6 +35,11 @@ is $org_rs->count, 1, "1 testing organisation";
|
||||||
|
|
||||||
my $org_id_shinra = $shinra_entity->organisation->id;
|
my $org_id_shinra = $shinra_entity->organisation->id;
|
||||||
|
|
||||||
|
$schema->resultset('Category')->create({
|
||||||
|
id => 1,
|
||||||
|
name => "Test Category",
|
||||||
|
});
|
||||||
|
|
||||||
#Valid customer, this also tests that redirects are disabled for register.
|
#Valid customer, this also tests that redirects are disabled for register.
|
||||||
print "test 1 - Create customer user account (Rufus)\n";
|
print "test 1 - Create customer user account (Rufus)\n";
|
||||||
my $emailRufus = 'test1@example.com';
|
my $emailRufus = 'test1@example.com';
|
||||||
|
@ -244,6 +249,7 @@ $json = {
|
||||||
purchase_time => $test_purchase_time,
|
purchase_time => $test_purchase_time,
|
||||||
organisation_id => $org_id_shinra,
|
organisation_id => $org_id_shinra,
|
||||||
session_key => $session_key,
|
session_key => $session_key,
|
||||||
|
category => 1,
|
||||||
};
|
};
|
||||||
$upload = {json => Mojo::JSON::encode_json($json), file => {file => './t/test.jpg'}};
|
$upload = {json => Mojo::JSON::encode_json($json), file => {file => './t/test.jpg'}};
|
||||||
$t->post_ok('/api/upload' => form => $upload )
|
$t->post_ok('/api/upload' => form => $upload )
|
||||||
|
@ -282,6 +288,7 @@ $json = {
|
||||||
street_name => "Slums, Sector 7",
|
street_name => "Slums, Sector 7",
|
||||||
town => "Midgar",
|
town => "Midgar",
|
||||||
postcode => "E1 0AA",
|
postcode => "E1 0AA",
|
||||||
|
category => 1,
|
||||||
session_key => $session_key,
|
session_key => $session_key,
|
||||||
};
|
};
|
||||||
$upload = {json => Mojo::JSON::encode_json($json), file => {file => './t/test.jpg'}};
|
$upload = {json => Mojo::JSON::encode_json($json), file => {file => './t/test.jpg'}};
|
||||||
|
@ -380,6 +387,7 @@ $json = {
|
||||||
purchase_time => $test_purchase_time,
|
purchase_time => $test_purchase_time,
|
||||||
organisation_id => $unvalidatedOrganisationId,
|
organisation_id => $unvalidatedOrganisationId,
|
||||||
session_key => $session_key,
|
session_key => $session_key,
|
||||||
|
category => 1,
|
||||||
};
|
};
|
||||||
$upload = {json => Mojo::JSON::encode_json($json), file => {file => './t/test.jpg'}};
|
$upload = {json => Mojo::JSON::encode_json($json), file => {file => './t/test.jpg'}};
|
||||||
$t->post_ok('/api/upload' => form => $upload )
|
$t->post_ok('/api/upload' => form => $upload )
|
||||||
|
|
|
@ -95,6 +95,11 @@ my $dtf = $schema->storage->datetime_parser;
|
||||||
# Number of hours in 90 days
|
# Number of hours in 90 days
|
||||||
my $time_count = 24 * 90;
|
my $time_count = 24 * 90;
|
||||||
|
|
||||||
|
$schema->resultset('Category')->create({
|
||||||
|
id => 1,
|
||||||
|
name => "Test Category",
|
||||||
|
});
|
||||||
|
|
||||||
for my $user ( $user1, $user2, $user3, $user4 ) {
|
for my $user ( $user1, $user2, $user3, $user4 ) {
|
||||||
|
|
||||||
my $start = DateTime->new(
|
my $start = DateTime->new(
|
||||||
|
@ -109,12 +114,16 @@ for my $user ( $user1, $user2, $user3, $user4 ) {
|
||||||
|
|
||||||
my $user_result = $schema->resultset('User')->find({ email => $user->{email} });
|
my $user_result = $schema->resultset('User')->find({ email => $user->{email} });
|
||||||
for ( 0 .. $time_count ) {
|
for ( 0 .. $time_count ) {
|
||||||
$user_result->create_related( 'transactions', {
|
my $test_transaction = $user_result->create_related( 'transactions', {
|
||||||
seller_id => $org_result->id,
|
seller_id => $org_result->id,
|
||||||
value => ( int( rand( 10000 ) ) / 100 ),
|
value => ( int( rand( 10000 ) ) / 100 ),
|
||||||
proof_image => 'a',
|
proof_image => 'a',
|
||||||
purchase_time => $start->clone->subtract( hours => $_ ),
|
purchase_time => $start->clone->subtract( hours => $_ ),
|
||||||
});
|
});
|
||||||
|
$schema->resultset('TransactionCategory')->create({
|
||||||
|
category_id => 1,
|
||||||
|
transaction_id => $test_transaction->id,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,4 +134,3 @@ $fixtures->dump({
|
||||||
schema => $schema,
|
schema => $schema,
|
||||||
directory => "$Bin/../data/" . $data_set,
|
directory => "$Bin/../data/" . $data_set,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Reference in a new issue