aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-13 16:10:12 +0800
committercrupest <crupest@outlook.com>2020-11-13 16:10:12 +0800
commitf34d9ccfa729c5367c5169d8461f74df11a5b2fb (patch)
tree56169c24d7cb81351f50b2d809ed86af82f9ad29 /BackEnd/Timeline
parent609804f4e7d5d27496c9c31ed1ec84d6e86313c3 (diff)
downloadtimeline-f34d9ccfa729c5367c5169d8461f74df11a5b2fb.tar.gz
timeline-f34d9ccfa729c5367c5169d8461f74df11a5b2fb.tar.bz2
timeline-f34d9ccfa729c5367c5169d8461f74df11a5b2fb.zip
test: Add integrated tests for permission api.
Diffstat (limited to 'BackEnd/Timeline')
-rw-r--r--BackEnd/Timeline/Controllers/UserController.cs4
-rw-r--r--BackEnd/Timeline/GlobalSuppressions.cs4
-rw-r--r--BackEnd/Timeline/Resources/Services/UserService.Designer.cs4
-rw-r--r--BackEnd/Timeline/Resources/Services/UserService.resx4
-rw-r--r--BackEnd/Timeline/Services/UserPermissionService.cs2
5 files changed, 8 insertions, 10 deletions
diff --git a/BackEnd/Timeline/Controllers/UserController.cs b/BackEnd/Timeline/Controllers/UserController.cs
index c5d1d4de..bbdb5d57 100644
--- a/BackEnd/Timeline/Controllers/UserController.cs
+++ b/BackEnd/Timeline/Controllers/UserController.cs
@@ -200,7 +200,7 @@ namespace Timeline.Controllers
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
- public async Task<ActionResult> PutUserPermission([FromRoute] string username, [FromRoute] UserPermission permission)
+ public async Task<ActionResult> PutUserPermission([FromRoute][Username] string username, [FromRoute] UserPermission permission)
{
try
{
@@ -220,7 +220,7 @@ namespace Timeline.Controllers
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
- public async Task<ActionResult> DeleteUserPermission([FromRoute] string username, [FromRoute] UserPermission permission)
+ public async Task<ActionResult> DeleteUserPermission([FromRoute][Username] string username, [FromRoute] UserPermission permission)
{
try
{
diff --git a/BackEnd/Timeline/GlobalSuppressions.cs b/BackEnd/Timeline/GlobalSuppressions.cs
index 2b0da576..155ed9ff 100644
--- a/BackEnd/Timeline/GlobalSuppressions.cs
+++ b/BackEnd/Timeline/GlobalSuppressions.cs
@@ -5,10 +5,8 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task", Justification = "This is not a UI application.")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1034:Nested types should not be visible", Justification = "This is not bad.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "No need to check the null because it's ASP.Net's duty.", Scope = "namespaceanddescendants", Target = "Timeline.Controllers")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "Migrations code are auto generated.", Scope = "namespaceanddescendants", Target = "Timeline.Migrations")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Generated error response identifiers.", Scope = "type", Target = "Timeline.Models.Http.ErrorResponse")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Generated error response identifiers.", Scope = "type", Target = "Timeline.Models.Http.ErrorResponse")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "Generated error response.", Scope = "type", Target = "Timeline.Models.Http.ErrorResponse")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:Uri properties should not be strings", Justification = "That's unnecessary.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "Adundant")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "Redundant")]
diff --git a/BackEnd/Timeline/Resources/Services/UserService.Designer.cs b/BackEnd/Timeline/Resources/Services/UserService.Designer.cs
index cdf7f390..564dd26c 100644
--- a/BackEnd/Timeline/Resources/Services/UserService.Designer.cs
+++ b/BackEnd/Timeline/Resources/Services/UserService.Designer.cs
@@ -70,7 +70,7 @@ namespace Timeline.Resources.Services {
}
/// <summary>
- /// Looks up a localized string similar to Nickname is of bad format, because {}..
+ /// Looks up a localized string similar to Nickname is of bad format, because {0}..
/// </summary>
internal static string ExceptionNicknameBadFormat {
get {
@@ -106,7 +106,7 @@ namespace Timeline.Resources.Services {
}
/// <summary>
- /// Looks up a localized string similar to Username is of bad format, because {}..
+ /// Looks up a localized string similar to Username is of bad format, because {0}..
/// </summary>
internal static string ExceptionUsernameBadFormat {
get {
diff --git a/BackEnd/Timeline/Resources/Services/UserService.resx b/BackEnd/Timeline/Resources/Services/UserService.resx
index 09bd4abb..1f3c0011 100644
--- a/BackEnd/Timeline/Resources/Services/UserService.resx
+++ b/BackEnd/Timeline/Resources/Services/UserService.resx
@@ -121,7 +121,7 @@
<value>New username is of bad format.</value>
</data>
<data name="ExceptionNicknameBadFormat" xml:space="preserve">
- <value>Nickname is of bad format, because {}.</value>
+ <value>Nickname is of bad format, because {0}.</value>
</data>
<data name="ExceptionOldUsernameBadFormat" xml:space="preserve">
<value>Old username is of bad format.</value>
@@ -133,7 +133,7 @@
<value>Password can't be null.</value>
</data>
<data name="ExceptionUsernameBadFormat" xml:space="preserve">
- <value>Username is of bad format, because {}.</value>
+ <value>Username is of bad format, because {0}.</value>
</data>
<data name="ExceptionUsernameConflict" xml:space="preserve">
<value>A user with given username already exists.</value>
diff --git a/BackEnd/Timeline/Services/UserPermissionService.cs b/BackEnd/Timeline/Services/UserPermissionService.cs
index deedf0a6..ff09b4ee 100644
--- a/BackEnd/Timeline/Services/UserPermissionService.cs
+++ b/BackEnd/Timeline/Services/UserPermissionService.cs
@@ -70,7 +70,7 @@ namespace Timeline.Services
/// <returns>A string list.</returns>
public List<string> ToStringList()
{
- return _permissions.Select(p => p.ToString().ToUpperInvariant()).ToList();
+ return _permissions.Select(p => p.ToString()).ToList();
}
/// <summary>