Skip to content

Commit

Permalink
Move /user to /users
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Aug 20, 2019
1 parent e221156 commit d283280
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Lystyng.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ get '/' => sub {
send_as html => template 'index.tt';
};

prefix '/user' => sub {
prefix '/users' => sub {
get '' => sub {
my @users = map { $_->json_data } $model->get_all_users;

Expand Down
8 changes: 4 additions & 4 deletions t/004_public_urls.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ my $test = Plack::Test->create($app);

my %route = (
'' => 200,
'user' => 200,
'user/test' => 404,
'user/test/list/test' => 404,
'users' => 200,
'users/test' => 404,
'users/test/list/test' => 404,
);

for (keys %route) {
Expand All @@ -45,7 +45,7 @@ for (keys %route) {

my $user = $sch->resultset('User')->create( $test_user_data );

my $res = $test->request(GET '/user/test');
my $res = $test->request(GET '/users/test');
is $res->code, 200, 'response status is 200 for /user/test';

$user->delete;
Expand Down
6 changes: 3 additions & 3 deletions t/006_lists.t
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ my $user = $sch->resultset('User')->find({
username => $test_user_data->{username},
});

$res = $test->request(POST "/user/$test_user_data->{username}/list/add",
$res = $test->request(POST "/users/$test_user_data->{username}/list/add",
Content_type => 'application/json',
Content => encode_json({
title => 'Test List',
Expand All @@ -53,7 +53,7 @@ is($res->code, 200, 'Status is 200');

my $list = $user->lists->first;

my $url = "/user/$test_user_data->{username}/list/test_list/item";
my $url = "/users/$test_user_data->{username}/list/test_list/item";
$res = $test->request(POST $url,
Content_type => 'application/json',
Content => encode_json({
Expand All @@ -66,7 +66,7 @@ $res = $test->request(POST $url,
ok($res, 'Got a response from adding a list item');
is($res->code, 200, 'Status is 200');

$res = $test->request(GET "/user/$test_user_data->{username}/list/test_list");
$res = $test->request(GET "/users/$test_user_data->{username}/list/test_list");

ok($res, 'Got a response from getting a list');
is($res->code, 200, 'Status is 200');
Expand Down

0 comments on commit d283280

Please sign in to comment.