mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
should be good to go now
This commit is contained in:
parent
9622e05cf5
commit
dec4691c73
|
@ -1070,18 +1070,20 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
|
|||
]
|
||||
)->name('api.users.restore');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Route::match(['put', 'patch'], '{user}/update', [Api\UsersController::class, 'update'])
|
||||
->name('api.users.update');
|
||||
|
||||
Route::resource('users',
|
||||
Api\UsersController::class,
|
||||
['names' => [
|
||||
'index' => 'api.users.index',
|
||||
'show' => 'api.users.show',
|
||||
'update' => 'api.users.update',
|
||||
'store' => 'api.users.store',
|
||||
'destroy' => 'api.users.destroy',
|
||||
],
|
||||
'except' => ['create', 'edit'],
|
||||
'except' => ['create', 'edit', 'update'],
|
||||
'parameters' => ['user' => 'user_id'],
|
||||
]
|
||||
); // end users API routes
|
||||
|
|
|
@ -365,6 +365,13 @@ class UpdateUserTest extends TestCase
|
|||
'company_id' => $companyB->id,
|
||||
])->assertStatusMessageIs('success');
|
||||
|
||||
// same test but PUT
|
||||
$this->actingAsForApi($superUser)->putJson(route('api.users.update', $user), [
|
||||
'username' => 'test',
|
||||
'first_name' => 'Test',
|
||||
'company_id' => $companyB->id,
|
||||
])->assertStatusMessageIs('success');
|
||||
|
||||
$asset->checkOut($user, $superUser);
|
||||
|
||||
// asset assigned, therefore error
|
||||
|
@ -372,6 +379,13 @@ class UpdateUserTest extends TestCase
|
|||
'username' => 'test',
|
||||
'company_id' => $companyB->id,
|
||||
])->assertStatusMessageIs('error');
|
||||
|
||||
// same test but PUT
|
||||
$this->actingAsForApi($superUser)->putJson(route('api.users.update', $user), [
|
||||
'username' => 'test',
|
||||
'first_name' => 'Test',
|
||||
'company_id' => $companyB->id,
|
||||
])->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -98,17 +98,22 @@ class UpdateUserTest extends TestCase
|
|||
|
||||
// no assets assigned, therefore success
|
||||
$this->actingAs($superUser)->put(route('users.update', $user), [
|
||||
'first_name' => 'test',
|
||||
'username' => 'test',
|
||||
'company_id' => $companyB->id,
|
||||
'first_name' => 'test',
|
||||
'username' => 'test',
|
||||
'company_id' => $companyB->id,
|
||||
'redirect_option' => 'index'
|
||||
])->assertRedirect(route('users.index'));
|
||||
|
||||
//$asset->checkOut($user, $superUser);
|
||||
$asset->checkOut($user, $superUser);
|
||||
|
||||
// asset assigned, therefore error
|
||||
//$this->actingAs($superUser)->patchJson(route('users.update', $user), [
|
||||
// 'username' => 'test',
|
||||
// 'company_id' => $companyB->id,
|
||||
//])->assertMessagesAre('error');
|
||||
$response = $this->actingAs($superUser)->patchJson(route('users.update', $user), [
|
||||
'first_name' => 'test',
|
||||
'username' => 'test',
|
||||
'company_id' => $companyB->id,
|
||||
'redirect_option' => 'index'
|
||||
]);
|
||||
|
||||
$this->followRedirects($response)->assertSee('error');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue