Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change controllers path #49

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Vulder.Admin.Api.Controllers.Admin;

[Authorize]
[ApiController]
[Route("/admin/[controller]")]
[Route("/admin/changePassword")]
public class ChangePasswordController : ControllerBase
{
private readonly IMediator _mediator;
Expand Down
2 changes: 1 addition & 1 deletion src/Vulder.Admin.Api/Controllers/Auth/LoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Vulder.Admin.Api.Controllers.Auth;

[ApiController]
[Route("/auth/[controller]")]
[Route("/auth/login")]
public class LoginController : ControllerBase
{
private readonly IMediator _mediator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Vulder.Admin.Api.Controllers.Auth;

[ApiController]
[Route("/auth/[controller]")]
[Route("/auth/register")]
public class RegisterController : ControllerBase
{
private readonly IMediator _mediator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async void POST_RegisterController_200_StatusCode()
var httpContent = new StringContent(JsonConvert.SerializeObject(changePasswordModel), Encoding.UTF8,
"application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {_adminCredentials.Token}");
using var response = await client.PutAsync("/admin/ChangePassword", httpContent);
using var response = await client.PutAsync("/admin/changePassword", httpContent);
var registerUserModel = JsonConvert.DeserializeObject<ResultDto>(await response.Content.ReadAsStringAsync());

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async void POST_1_RegisterController_200_StatusCode()
await using var application = new WebServerFactory();
using var client = application.CreateClient();
var httpContent = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
using var response = await client.PostAsync("/auth/Register", httpContent);
using var response = await client.PostAsync("/auth/register", httpContent);
var registerUserModel = JsonConvert.DeserializeObject<AuthUserDto>(await response.Content.ReadAsStringAsync());

_adminCredentials.Token = registerUserModel?.Token;
Expand All @@ -54,7 +54,7 @@ public async void POST_2_RegisterController_500_StatusCode()
await using var application = new WebServerFactory();
using var client = application.CreateClient();
var httpContent = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
using var response = await client.PostAsync("/auth/Register", httpContent);
using var response = await client.PostAsync("/auth/register", httpContent);

Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
}
Expand All @@ -73,7 +73,7 @@ public async void POST_3_LoginController_200_StatusCode()
using var client = application.CreateClient();

var httpContent = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
using var response = await client.PostAsync("/auth/Login", httpContent);
using var response = await client.PostAsync("/auth/login", httpContent);
var registerUserModel = JsonConvert.DeserializeObject<AuthUserDto>(await response.Content.ReadAsStringAsync());

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Expand Down