You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 17601a7
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: webapi/src/test/scala/org/knora/webapi/messages/admin/responder/projectsmessages/ProjectsMessagesADMSpec.scala
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -108,6 +108,40 @@ class ProjectsMessagesADMSpec extends CoreSpec(ProjectsMessagesADMSpec.config) {
108
108
)
109
109
assert(caught.getMessage ==="Project shortcode must be supplied.")
110
110
}
111
+
112
+
"return 'BadRequestException' if project 'shortname' is not NCName valid" in {
113
+
valinvalidShortName="abd%2"
114
+
valcaught= intercept[BadRequestException](
115
+
CreateProjectApiRequestADM(
116
+
shortname = invalidShortName,
117
+
shortcode ="1114",
118
+
longname =Some("project longname"),
119
+
description =Seq(StringLiteralV2(value ="project description", language =Some("en"))),
120
+
keywords =Seq("keywords"),
121
+
logo =Some("/fu/bar/baz.jpg"),
122
+
status =true,
123
+
selfjoin =false
124
+
).validateAndEscape
125
+
)
126
+
assert(caught.getMessage ===s"The supplied short name: '$invalidShortName' is not valid.")
127
+
}
128
+
129
+
"return 'BadRequestException' if project 'shortname' is not URL safe" in {
130
+
valinvalidShortName="äbd2"
131
+
valcaught= intercept[BadRequestException](
132
+
CreateProjectApiRequestADM(
133
+
shortname = invalidShortName,
134
+
shortcode ="1114",
135
+
longname =Some("project longname"),
136
+
description =Seq(StringLiteralV2(value ="project description", language =Some("en"))),
137
+
keywords =Seq("keywords"),
138
+
logo =Some("/fu/bar/baz.jpg"),
139
+
status =true,
140
+
selfjoin =false
141
+
).validateAndEscape
142
+
)
143
+
assert(caught.getMessage ===s"The supplied short name: '$invalidShortName' is not valid.")
144
+
}
111
145
}
112
146
113
147
"The ChangeProjectApiRequestADM case class" should {
0 commit comments