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