1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-21 05:31:42 +00:00

Closes #379: spaces and colons not allowed in tag name

This commit is contained in:
bgamard
2020-02-14 21:40:13 +01:00
parent 89228a52dc
commit d619f98de7
4 changed files with 44 additions and 17 deletions

View File

@@ -25,7 +25,23 @@ public class TestTagResource extends BaseJerseyTest {
// Login tag1
clientUtil.createUser("tag1");
String tag1Token = clientUtil.login("tag1");
// Create a tag with a wrong name
Response response = target().path("/tag").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, tag1Token)
.put(Entity.form(new Form()
.param("name", "Tag:3")
.param("color", "#ff0000")));
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
// Create a tag with a wrong name
response = target().path("/tag").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, tag1Token)
.put(Entity.form(new Form()
.param("name", "Tag 3")
.param("color", "#ff0000")));
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
// Create a tag
JsonObject json = target().path("/tag").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, tag1Token)
@@ -46,7 +62,7 @@ public class TestTagResource extends BaseJerseyTest {
Assert.assertNotNull(tag4Id);
// Create a circular reference
Response response = target().path("/tag/" + tag3Id).request()
response = target().path("/tag/" + tag3Id).request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, tag1Token)
.post(Entity.form(new Form()
.param("name", "Tag3")