Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
3e1e40fe
Commit
3e1e40fe
authored
5 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: add unit to create a course with REST and CourseVO
parent
f3a7c25e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/olat/restapi/CoursesTest.java
+30
-0
30 additions, 0 deletions
src/test/java/org/olat/restapi/CoursesTest.java
with
30 additions
and
0 deletions
src/test/java/org/olat/restapi/CoursesTest.java
+
30
−
0
View file @
3e1e40fe
...
@@ -322,6 +322,36 @@ public class CoursesTest extends OlatRestTestCase {
...
@@ -322,6 +322,36 @@ public class CoursesTest extends OlatRestTestCase {
assertNotNull
(
re
);
assertNotNull
(
re
);
assertNotNull
(
re
.
getOlatResource
());
assertNotNull
(
re
.
getOlatResource
());
}
}
@Test
public
void
testCreateEmptyCourse_CourseVO
()
throws
IOException
,
URISyntaxException
{
assertTrue
(
conn
.
login
(
"administrator"
,
"openolat"
));
CourseVO
courseVo
=
new
CourseVO
();
courseVo
.
setTitle
(
"Course 14 long name"
);
courseVo
.
setAuthors
(
"Prof.Dr. 14"
);
courseVo
.
setLocation
(
"Z\u00FCrich"
);
URI
uri
=
UriBuilder
.
fromUri
(
getContextURI
()).
path
(
"repo"
).
path
(
"courses"
).
build
();
HttpPut
method
=
conn
.
createPut
(
uri
,
MediaType
.
APPLICATION_JSON
,
true
);
conn
.
addJsonEntity
(
method
,
courseVo
);
HttpResponse
response
=
conn
.
execute
(
method
);
Assert
.
assertEquals
(
200
,
response
.
getStatusLine
().
getStatusCode
());
CourseVO
course
=
conn
.
parse
(
response
,
CourseVO
.
class
);
Assert
.
assertNotNull
(
course
);
Assert
.
assertEquals
(
"Course 14 long name"
,
course
.
getTitle
());
Assert
.
assertEquals
(
"Z\u00FCrich"
,
course
.
getLocation
());
Assert
.
assertEquals
(
"Prof.Dr. 14"
,
course
.
getAuthors
());
//check repository entry
RepositoryEntry
re
=
repositoryManager
.
lookupRepositoryEntry
(
course
.
getRepoEntryKey
());
Assert
.
assertNotNull
(
re
);
Assert
.
assertNotNull
(
re
.
getOlatResource
());
Assert
.
assertEquals
(
"Course 14 long name"
,
re
.
getDisplayname
());
Assert
.
assertEquals
(
"Z\u00FCrich"
,
re
.
getLocation
());
Assert
.
assertEquals
(
"Prof.Dr. 14"
,
re
.
getAuthors
());
}
@Test
@Test
public
void
testCreateEmpty_withoutAuthorCourse
()
throws
IOException
,
URISyntaxException
{
public
void
testCreateEmpty_withoutAuthorCourse
()
throws
IOException
,
URISyntaxException
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment