Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Softeng Group 6 2021 Even Semester
Teaching Assistant Student Connector
Commits
ce58093e
Commit
ce58093e
authored
Jun 07, 2021
by
Johanes Steven
Browse files
Add more unit tests
parent
13693722
Pipeline
#81883
failed with stages
in 12 minutes and 9 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/resources/application.properties
View file @
ce58093e
spring.datasource.url
=
jdbc:postgresql://
ec2-3-212-75-25.compute-1.amazonaws.com:5432/dds939tlhunclk
spring.datasource.username
=
cnxgzqmgtjwgwt
spring.datasource.password
=
2e6f389654422dbd3406d431a243f61e5e5543ddc80a84d14afd6dcbe910f4d8
spring.datasource.currentSchema
=
publi
c
spring.datasource.url
=
jdbc:postgresql://
localhost:5432/tasc
spring.datasource.username
=
postgres
spring.datasource.password
=
admin
spring.datasource.currentSchema
=
tas
c
spring.datasource.hikari.maximum-pool-size
=
10
logging.level.root
=
info
src/test/java/com/adpro/tasc/TestApp.java
View file @
ce58093e
...
...
@@ -13,58 +13,9 @@ public class TestApp {
@Autowired
private
HelloController
controller
;
@Autowired
private
AddRolesController
addRolesController
;
@Autowired
private
BookAppointmentController
bookAppointmentController
;
@Autowired
private
CreateCoursesController
createCoursesController
;
@Autowired
private
CreateScheduleController
createScheduleController
;
@Autowired
private
SeeAppointmentController
seeAppointmentController
;
@Autowired
private
UserListCoursesController
userListCoursesController
;
@Test
void
contextLoads
()
{
assertThat
(
controller
).
isNotNull
();
}
@Test
void
AddRolesTest
()
{
assertThat
(
addRolesController
).
isNotNull
();
}
@Test
void
BookAppointmentTest
()
{
assertThat
(
bookAppointmentController
).
isNotNull
();
}
@Test
void
CreateCoursesControllerTest
()
{
assertThat
(
createCoursesController
).
isNotNull
();
}
@Test
void
CreateScheduleControllerTest
()
{
assertThat
(
createScheduleController
).
isNotNull
();
}
@Test
void
SeeAppointmentControllerTest
()
{
assertThat
(
seeAppointmentController
).
isNotNull
();
}
@Test
void
UserListCoursesControllerTest
()
{
assertThat
(
userListCoursesController
).
isNotNull
();
}
}
src/test/java/com/adpro/tasc/controller/HelloControllerTest.java
View file @
ce58093e
...
...
@@ -69,4 +69,160 @@ public class HelloControllerTest {
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
loginWithNoRoleTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/home-TA"
).
with
(
user
(
"none"
).
password
(
"{noop}123"
).
roles
(
"UNASSIGNED"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isForbidden
());
}
@Test
public
void
loginWithNoRole2
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/waiting"
).
with
(
user
(
"none"
).
password
(
"{noop}123"
).
roles
(
"UNASSIGNED"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
navAdminTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/nav-admin"
).
with
(
user
(
"admin"
).
password
(
"{noop}123"
).
roles
(
"ADMIN"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
navStudentTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/nav-student"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
navTATest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/nav-TA"
).
with
(
user
(
"ta"
).
password
(
"{noop}123"
).
roles
(
"TEACHING_ASSISTANT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
addRolesTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/add-roles"
).
with
(
user
(
"admin"
).
password
(
"{noop}123"
).
roles
(
"ADMIN"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
createCoursesTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/create-course"
).
with
(
user
(
"admin"
).
password
(
"{noop}123"
).
roles
(
"ADMIN"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
reminderTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/reminder"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
courseListTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/userlist-courses"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
seeAppointmentAdminTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/see-appointment-admin"
).
with
(
user
(
"admin"
).
password
(
"{noop}123"
).
roles
(
"ADMIN"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
seeAppointmentTATest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/see-appointment-TA"
).
with
(
user
(
"ta"
).
password
(
"{noop}123"
).
roles
(
"TEACHING_ASSISTANT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
seeAppointmentStudentTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/see-appointment-student"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
acceptRejectTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/accept_reject"
).
with
(
user
(
"ta"
).
password
(
"{noop}123"
).
roles
(
"TEACHING_ASSISTANT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
createScheduleTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/create-schedule"
).
with
(
user
(
"ta"
).
password
(
"{noop}123"
).
roles
(
"TEACHING_ASSISTANT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
addSlotTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/add-slot"
).
with
(
user
(
"ta"
).
password
(
"{noop}123"
).
roles
(
"TEACHING_ASSISTANT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
bookAppointmentTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/book-appointment/home"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
)))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
bookAppointmentPickTATest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/book-appointment/pick-ta"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
))
.
param
(
"courseName"
,
"Software Engineering"
))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
bookAppointmentSeeTAScheduleTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/book-appointment/see-ta-schedule"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
))
.
param
(
"taUserName"
,
"ta"
)
.
param
(
"courseName"
,
"Software Engineering"
))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
@Test
public
void
bookAppointmentBookTest
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/book-appointment/book"
).
with
(
user
(
"student"
).
password
(
"{noop}123"
).
roles
(
"STUDENT"
))
.
param
(
"startTime"
,
"0"
)
.
param
(
"finishTime"
,
"3600000"
)
.
param
(
"day"
,
"MONDAY"
)
.
param
(
"taUserName"
,
"ta"
)
.
param
(
"courseName"
,
"Software Engineering"
)
.
param
(
"bookTime"
,
String
.
valueOf
(
System
.
currentTimeMillis
()))
.
param
(
"error"
,
"false"
))
.
andDo
(
print
()).
andExpect
(
status
().
isOk
());
}
// @Test
// public void courseListJoinTest() throws Exception {
// this.mockMvc
// .perform(post("/userlist-courses/assign").with(user("student").password("{noop}123").roles("STUDENT"))
// .param("userName","student")
// .param("courseName","Software Engineering"))
// .andDo(print()).andExpect(status().isOk());
// }
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment