Akron | e8235be | 2016-06-27 11:02:18 +0200 | [diff] [blame] | 1 | use Mojo::Base -strict; |
| 2 | use lib '../lib', 'lib'; |
| 3 | use Test::More skip_all => 'No remote tests'; |
| 4 | use Test::Mojo; |
| 5 | use Data::Dumper; |
| 6 | |
| 7 | $ENV{MOJO_USERAGENT_DEBUG} = 1; |
| 8 | |
| 9 | my $t = Test::Mojo->new('Kalamar'); |
| 10 | |
| 11 | my $c = $t->app->build_controller; |
| 12 | |
| 13 | |
| 14 | ok(!$c->user->get('details'), 'User not logged in'); |
| 15 | |
| 16 | # Login with user credentials |
| 17 | ok($c->user->login('kustvakt', 'kustvakt2015'), 'Login with demo user'); |
| 18 | is($c->stash('user'), 'kustvakt', 'Kustvakt is logged in'); |
| 19 | like($c->stash('auth'), qr/^api_token /, 'Kustvakt is logged in'); |
| 20 | |
| 21 | my $details = $c->user->get('details'); |
| 22 | is($details->{email}, 'kustvakt@ids-mannheim.de', 'Email'); |
| 23 | is($details->{firstName}, 'Kustvakt', 'Firstname'); |
| 24 | is($details->{lastName}, 'KorAP', 'Lastname'); |
| 25 | is($details->{country}, 'Germany', 'Country'); |
| 26 | is($details->{address}, 'Mannheim', 'Address'); |
| 27 | is($details->{username}, 'kustvakt', 'Username'); |
| 28 | is($details->{institution}, 'IDS Mannheim', 'Institution'); |
| 29 | |
| 30 | my $settings = $c->user->get('settings'); |
| 31 | is($settings->{username}, 'kustvakt', 'Username'); |
| 32 | |
| 33 | # ok($c->user->set(details => { firstName => 'Me' }), 'Set first name'); |
| 34 | #ok($c->user->set(details => { |
| 35 | # firstName => 'Akron', |
| 36 | # lastName => 'Fuxfell' |
| 37 | #}), 'Set first name'); |
| 38 | |
| 39 | # diag Dumper $c->user->get('info'); |
| 40 | |
| 41 | ok(1,'Fine'); |
| 42 | |
| 43 | done_testing; |
| 44 | __END__ |