Merge pull request #6 from Pear-Trading/TBSliver/Basic-CORS

Added Basic CORS for api endpoints, as well as other fixes
This commit is contained in:
Finn 2017-04-27 13:05:06 +01:00 committed by GitHub
commit 233d5d3371
13 changed files with 164 additions and 74 deletions

View file

@ -16,3 +16,4 @@ requires 'SQL::Translator';
requires 'DateTime'; requires 'DateTime';
requires 'DateTime::Format::Strptime', "1.73"; requires 'DateTime::Format::Strptime', "1.73";
requires 'DateTime::Format::SQLite'; requires 'DateTime::Format::SQLite';
requires 'Try::Tiny';

View file

@ -110,11 +110,23 @@ sub startup {
# $r->post('/register')->to('register#register'); # $r->post('/register')->to('register#register');
$r->any('/admin/logout')->to('admin#auth_logout'); $r->any('/admin/logout')->to('admin#auth_logout');
my $api_public_get = $r->under('/api'); my $api_public_get = $r->under('/api' => sub {
my $c = shift;
$c->res->headers->header('Access-Control-Allow-Origin'=> '*');
$c->res->headers->header('Access-Control-Allow-Credentials' => 'true');
$c->res->headers->header('Access-Control-Allow-Methods' => 'GET, OPTIONS, POST, DELETE, PUT');
$c->res->headers->header('Access-Control-Allow-Headers' => 'Content-Type, X-CSRF-Token');
$c->res->headers->header('Access-Control-Max-Age' => '1728000');
});
$api_public_get->options('*' => sub {
my $c = shift;
$c->respond_to(any => { data => '', status => 200 });
});
$api_public_get->get('/info/ages')->to('api-info#get_ages'); $api_public_get->get('/info/ages')->to('api-info#get_ages');
# Always available api routes # Always available api routes
my $api_public = $r->under('/api')->to('api-auth#check_json'); my $api_public = $api_public_get->under('/')->to('api-auth#check_json');
$api_public->post('/login')->to('api-auth#post_login'); $api_public->post('/login')->to('api-auth#post_login');
$api_public->post('/register')->to('api-register#post_register'); $api_public->post('/register')->to('api-register#post_register');

View file

@ -11,6 +11,12 @@ has error_messages => sub {
name => { name => {
required => { message => 'No name sent or was blank.', status => 400 }, required => { message => 'No name sent or was blank.', status => 400 },
}, },
display_name => {
required => { message => 'No name sent or was blank.', status => 400 },
},
full_name => {
required => { message => 'No name sent or was blank.', status => 400 },
},
email => { email => {
required => { message => 'No email sent.', status => 400 }, required => { message => 'No email sent.', status => 400 },
email => { message => 'Email is invalid.', status => 400 }, email => { message => 'Email is invalid.', status => 400 },
@ -54,16 +60,18 @@ sub post_register{
$validation->required('email')->email->not_in_resultset('email', $user_rs); $validation->required('email')->email->not_in_resultset('email', $user_rs);
$validation->required('password'); $validation->required('password');
$validation->required('name');
$validation->required('postcode')->postcode; $validation->required('postcode')->postcode;
$validation->required('usertype')->in('customer', 'organisation'); $validation->required('usertype')->in('customer', 'organisation');
my $usertype = $validation->param('usertype') || ''; my $usertype = $validation->param('usertype') || '';
if ( $usertype eq 'customer' ) { if ( $usertype eq 'customer' ) {
$validation->required('display_name');
$validation->required('full_name');
my $age_rs = $c->schema->resultset('AgeRange'); my $age_rs = $c->schema->resultset('AgeRange');
$validation->required('age_range')->number->in_resultset('id', $age_rs); $validation->required('age_range')->number->in_resultset('id', $age_rs);
} elsif ( $usertype eq 'organisation' ) { } elsif ( $usertype eq 'organisation' ) {
$validation->required('name');
$validation->required('street_name'); $validation->required('street_name');
$validation->required('town'); $validation->required('town');
} }
@ -79,7 +87,8 @@ sub post_register{
})->update({ used => 1 }); })->update({ used => 1 });
$c->schema->resultset('User')->create({ $c->schema->resultset('User')->create({
customer => { customer => {
name => $validation->param('name'), full_name => $validation->param('full_name'),
display_name => $validation->param('display_name'),
age_range_id => $validation->param('age_range'), age_range_id => $validation->param('age_range'),
postcode => $validation->param('postcode'), postcode => $validation->param('postcode'),
}, },

View file

@ -6,6 +6,7 @@ use Geo::UK::Postcode;
use Scalar::Util qw/ looks_like_number /; use Scalar::Util qw/ looks_like_number /;
use File::Basename qw/ fileparse /; use File::Basename qw/ fileparse /;
use DateTime::Format::Strptime; use DateTime::Format::Strptime;
use Try::Tiny;
sub register { sub register {
my ( $plugin, $app, $conf ) = @_; my ( $plugin, $app, $conf ) = @_;
@ -27,7 +28,14 @@ sub register {
$app->validator->add_check( postcode => sub { $app->validator->add_check( postcode => sub {
my ( $validation, $name, $value ) = @_; my ( $validation, $name, $value ) = @_;
return Geo::UK::Postcode->new( $value )->valid ? undef : 1; my $postcode;
try {
$postcode = Geo::UK::Postcode->new( $value );
};
return 1 unless defined( $postcode );
return 1 if $postcode->partial;
return undef if $postcode->valid;
return 1;
}); });
$app->validator->add_check( number => sub { $app->validator->add_check( number => sub {

View file

@ -13,7 +13,12 @@ __PACKAGE__->add_columns(
is_auto_increment => 1, is_auto_increment => 1,
is_nullable => 0, is_nullable => 0,
}, },
"name" => { "display_name" => {
data_type => "varchar",
size => 255,
is_nullable => 0,
},
"full_name" => {
data_type => "varchar", data_type => "varchar",
size => 255, size => 255,
is_nullable => 0, is_nullable => 0,

View file

@ -25,7 +25,8 @@ my $passwordReno = 'turks';
my $testJson = { my $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'Reno', 'full_name' => 'Reno',
'display_name' => 'Reno',
'email' => $emailReno, 'email' => $emailReno,
'postcode' => 'SA4 3FA', 'postcode' => 'SA4 3FA',
'password' => $passwordReno, 'password' => $passwordReno,
@ -58,7 +59,8 @@ my $passwordAdmin = 'ethics';
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'admin', 'display_name' => 'admin',
'full_name' => 'admin',
'email' => $emailAdmin, 'email' => $emailAdmin,
'postcode' => 'HD5 9XU', 'postcode' => 'HD5 9XU',
'password' => $passwordAdmin, 'password' => $passwordAdmin,

View file

@ -25,7 +25,8 @@ my $passwordReno = 'turks';
my $testJson = { my $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'Reno', 'full_name' => 'Reno',
'display_name' => 'Reno',
'email' => $emailReno, 'email' => $emailReno,
'postcode' => 'SA4 3FA', 'postcode' => 'SA4 3FA',
'password' => $passwordReno, 'password' => $passwordReno,
@ -59,7 +60,8 @@ my $passwordAdmin = 'ethics';
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'admin', 'display_name' => 'admin',
'full_name' => 'admin',
'email' => $emailAdmin, 'email' => $emailAdmin,
'postcode' => 'HD5 9XU', 'postcode' => 'HD5 9XU',
'password' => $passwordAdmin, 'password' => $passwordAdmin,

View file

@ -19,7 +19,8 @@ $schema->resultset('AccountToken')->create({
my $test_json = { my $test_json = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => $account_token, 'token' => $account_token,
'name' => 'RufusShinra', 'display_name' => 'RufusShinra',
'full_name' => 'RufusShinra',
'email' => $email, 'email' => $email,
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => $password, 'password' => $password,

View file

@ -19,7 +19,8 @@ $schema->resultset('AccountToken')->create({
$framework->register_customer({ $framework->register_customer({
'token' => $account_token, 'token' => $account_token,
'name' => 'Test User', 'full_name' => 'Test User',
'display_name' => 'Test User',
'email' => $email, 'email' => $email,
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => $password, 'password' => $password,

View file

@ -14,20 +14,26 @@ my $valid_email = 'test@example.com';
my $invalid_email = 'test.example.com'; my $invalid_email = 'test.example.com';
my $valid_postcode = 'WC1H 9EB'; my $valid_postcode = 'WC1H 9EB';
my $invalid_postcode = 'AB1 2CD'; my $invalid_postcode = 'AB1 2CD';
my $not_a_postcode = 'a';
my $not_a_whole_postcode = 'LA1';
$validation->input({ $validation->input({
valid_email => $valid_email, valid_email => $valid_email,
invalid_email => $invalid_email, invalid_email => $invalid_email,
valid_postcode => $valid_postcode, valid_postcode => $valid_postcode,
invalid_postcode => $invalid_postcode, invalid_postcode => $invalid_postcode,
not_a_postcode => $not_a_postcode,
not_a_whole_postcode => $not_a_whole_postcode,
}); });
$validation->required('valid_email')->email; $validation->required('valid_email')->email;
$validation->required('invalid_email')->email; $validation->required('invalid_email')->email;
$validation->required('valid_postcode')->postcode; $validation->required('valid_postcode')->postcode;
$validation->required('invalid_postcode')->postcode; $validation->required('invalid_postcode')->postcode;
$validation->required('not_a_postcode')->postcode;
$validation->required('not_a_whole_postcode')->postcode;
ok $validation->has_error, 'Have Errors'; ok $validation->has_error, 'Have Errors';
is_deeply $validation->failed, [ 'invalid_email', 'invalid_postcode' ], 'Correct Errors'; is_deeply $validation->failed, [ qw/ invalid_email invalid_postcode not_a_postcode not_a_whole_postcode / ], 'Correct Errors';
done_testing; done_testing;

View file

@ -10,8 +10,6 @@ my $schema = $t->app->schema;
my $dump_error = sub { diag $t->tx->res->dom->at('pre[id="error"]')->text }; my $dump_error = sub { diag $t->tx->res->dom->at('pre[id="error"]')->text };
#Variables to be used for uniqueness when testing. #Variables to be used for uniqueness when testing.
my @names = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
my @emails = ('a@a.com', 'b@a.com', 'c@a.com', 'd@a.com', 'e@a.com', 'f@a.com', 'g@a.com', 'h@a.com', 'i@a.com', 'j@a.com', 'k@a.com', 'l@a.com', 'm@a.com', 'n@a.com', 'o@a.com', 'p@a.com', 'q@a.com', 'r@a.com', 's@a.com', 't@a.com', 'u@a.com', 'v@a.com', 'w@a.com', 'x@a.com', 'y@a.com', 'z@a.com');
my @tokens = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); my @tokens = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
$schema->resultset('AccountToken')->populate([ $schema->resultset('AccountToken')->populate([
@ -33,8 +31,9 @@ $t->post_ok('/api/register' => json => $testJson)
#token missing JSON #token missing JSON
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -44,13 +43,13 @@ $t->post_ok('/api/register' => json => $testJson)
->json_is('/success', Mojo::JSON->false) ->json_is('/success', Mojo::JSON->false)
->content_like(qr/no token sent/i); ->content_like(qr/no token sent/i);
#Not valid token. #Not valid token.
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => ' ', 'token' => 'testing',
'name' => shift(@names), 'display_name' => 'test name',
'email' => shift(@emails), 'full_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -64,8 +63,23 @@ $t->post_ok('/api/register' => json => $testJson)
#name missing JSON #name missing JSON
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'a',
'email' => shift(@emails), 'full_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA',
'password' => 'Meh',
'age_range' => 3
};
$t->post_ok('/api/register' => json => $testJson)
->status_is(400)
->json_is('/success', Mojo::JSON->false)
->content_like(qr/no name sent/i);
#name missing JSON
$testJson = {
'usertype' => 'customer',
'token' => 'a',
'display_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -75,13 +89,29 @@ $t->post_ok('/api/register' => json => $testJson)
->json_is('/success', Mojo::JSON->false) ->json_is('/success', Mojo::JSON->false)
->content_like(qr/no name sent/i); ->content_like(qr/no name sent/i);
#Blank name #Blank name
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'a',
'name' => '', 'display_name' => 'test name',
'email' => shift(@emails), 'full_name' => '',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA',
'password' => 'Meh',
'age_range' => 3
};
$t->post_ok('/api/register' => json => $testJson)
->status_is(400)
->json_is('/success', Mojo::JSON->false)
->content_like(qr/blank/i)
->content_like(qr/name/i);
#Blank name
$testJson = {
'usertype' => 'customer',
'token' => 'a',
'display_name' => '',
'full_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -92,15 +122,14 @@ $t->post_ok('/api/register' => json => $testJson)
->content_like(qr/blank/i) ->content_like(qr/blank/i)
->content_like(qr/name/i); ->content_like(qr/name/i);
my $nameToReuse = shift(@names);
my $emailToReuse = shift(@emails);
#Valid customer #Valid customer
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'a',
'name' => $nameToReuse, 'full_name' => 'test name',
'email' => $emailToReuse, 'display_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -112,9 +141,10 @@ $t->post_ok('/api/register' => json => $testJson)
#Valid customer2 #Valid customer2
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'b',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'b@c.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 2 'age_range' => 2
@ -126,9 +156,10 @@ $t->post_ok('/api/register' => json => $testJson)
#Valid customer3 #Valid customer3
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'c',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'c@d.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 1 'age_range' => 1
@ -140,8 +171,9 @@ $t->post_ok('/api/register' => json => $testJson)
#email missing JSON #email missing JSON
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'd',
'name' => shift(@names), 'full_name' => 'test name',
'display_name' => 'test name',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -154,8 +186,9 @@ $t->post_ok('/api/register' => json => $testJson)
#invalid email 1 #invalid email 1
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'd',
'name' => shift(@names), 'full_name' => 'test name',
'display_name' => 'test name',
'email' => 'dfsd@.com', 'email' => 'dfsd@.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
@ -170,8 +203,9 @@ $t->post_ok('/api/register' => json => $testJson)
#invalid email 2 #invalid email 2
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'd',
'name' => shift(@names), 'full_name' => 'test name',
'display_name' => 'test name',
'email' => 'dfsd@com', 'email' => 'dfsd@com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
@ -186,9 +220,10 @@ $t->post_ok('/api/register' => json => $testJson)
#Email exists #Email exists
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'd',
'name' => shift(@names), 'full_name' => 'test name',
'email' => $emailToReuse, 'display_name' => 'test name',
'email' => 'a@b.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 2 'age_range' => 2
@ -202,9 +237,10 @@ $t->post_ok('/api/register' => json => $testJson)
#postcode missing JSON #postcode missing JSON
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'd',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'd@e.com',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
}; };
@ -218,9 +254,10 @@ $t->post_ok('/api/register' => json => $testJson)
#password missing JSON #password missing JSON
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'd',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'd@e.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'age_range' => 3 'age_range' => 3
}; };
@ -233,9 +270,10 @@ $t->post_ok('/api/register' => json => $testJson)
#usertype missing JSON #usertype missing JSON
$testJson = { $testJson = {
'token' => shift(@tokens), 'token' => 'f',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'd@e.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 3 'age_range' => 3
@ -248,9 +286,9 @@ $t->post_ok('/api/register' => json => $testJson)
#Invalid user type #Invalid user type
$testJson = { $testJson = {
'usertype' => 'organisation1', 'usertype' => 'organisation1',
'token' => shift(@tokens), 'token' => 'f',
'name' => shift(@names), 'name' => 'test name',
'email' => shift(@emails), 'email' => 'org@org.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'fulladdress' => 'mary lane testing....' 'fulladdress' => 'mary lane testing....'
@ -265,9 +303,10 @@ $t->post_ok('/api/register' => json => $testJson)
#age_range missing JSON #age_range missing JSON
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'f',
'name' => shift(@names), 'display_name' => 'test name',
'email' => shift(@emails), 'full_name' => 'test name',
'email' => 'broke@example.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
}; };
@ -279,9 +318,10 @@ $t->post_ok('/api/register' => json => $testJson)
#Age is invalid #Age is invalid
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@tokens), 'token' => 'f',
'name' => shift(@names), 'full_name' => 'test name',
'email' => shift(@emails), 'display_name' => 'test name',
'email' => 'test@example.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'age_range' => 'invalid' 'age_range' => 'invalid'
@ -295,9 +335,9 @@ $t->post_ok('/api/register' => json => $testJson)
#full address missing JSON #full address missing JSON
$testJson = { $testJson = {
'usertype' => 'organisation', 'usertype' => 'organisation',
'token' => shift(@tokens), 'token' => 'f',
'name' => shift(@names), 'name' => 'test org',
'email' => shift(@emails), 'email' => 'org@org.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
}; };
@ -311,9 +351,9 @@ $t->post_ok('/api/register' => json => $testJson)
#Organisation valid #Organisation valid
$testJson = { $testJson = {
'usertype' => 'organisation', 'usertype' => 'organisation',
'token' => shift(@tokens), 'token' => 'f',
'name' => shift(@names), 'name' => 'org name',
'email' => shift(@emails), 'email' => 'org@org.com',
'postcode' => 'LA1 1AA', 'postcode' => 'LA1 1AA',
'password' => 'Meh', 'password' => 'Meh',
'street_name' => 'mary lane testing....', 'street_name' => 'mary lane testing....',

View file

@ -31,7 +31,8 @@ my $passwordRufus = 'MakoGold';
my $testJson = { my $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'RufusShinra', 'full_name' => 'RufusShinra',
'display_name' => 'RufusShinra',
'email' => $emailRufus, 'email' => $emailRufus,
'postcode' => 'RG26 5NU', 'postcode' => 'RG26 5NU',
'password' => $passwordRufus, 'password' => $passwordRufus,

View file

@ -38,7 +38,8 @@ my $passwordRufus = 'MakoGold';
my $testJson = { my $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'RufusShinra', 'full_name' => 'RufusShinra',
'display_name' => 'RufusShinra',
'email' => $emailRufus, 'email' => $emailRufus,
'postcode' => 'GU10 5SA', 'postcode' => 'GU10 5SA',
'password' => $passwordRufus, 'password' => $passwordRufus,
@ -54,7 +55,8 @@ my $passwordHojo = 'Mako';
$testJson = { $testJson = {
'usertype' => 'customer', 'usertype' => 'customer',
'token' => shift(@account_tokens), 'token' => shift(@account_tokens),
'name' => 'ProfessorHojo', 'display_name' => 'ProfessorHojo',
'full_name' => 'ProfessorHojo',
'email' => $emailHojo, 'email' => $emailHojo,
'postcode' => 'DE15 9LT', 'postcode' => 'DE15 9LT',
'password' => $passwordHojo, 'password' => $passwordHojo,