Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Jan Maximilian Michal
grady
Commits
27c5fd73
Commit
27c5fd73
authored
2 years ago
by
Jakob Dieterle
Browse files
Options
Downloads
Patches
Plain Diff
reverted changes to export tests as well
parent
004e429b
No related branches found
No related tags found
No related merge requests found
Pipeline
#322135
failed
2 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/tests/test_export.py
+17
-13
17 additions, 13 deletions
core/tests/test_export.py
core/views/export.py
+0
-3
0 additions, 3 deletions
core/views/export.py
with
17 additions
and
16 deletions
core/tests/test_export.py
+
17
−
13
View file @
27c5fd73
...
...
@@ -96,7 +96,9 @@ class ExportInstanceTest(APITestCase):
def
setUp
(
self
):
self
.
client
=
APIClient
()
self
.
client
.
force_login
(
user
=
self
.
data
[
'
reviewers
'
][
0
])
self
.
response
=
self
.
client
.
get
(
'
/api/instance/export/
'
)
self
.
response
=
self
.
client
.
get
(
'
/api/instance/export/
'
,
data
=
{
'
setPasswords
'
:
True
,
'
selected_exam
'
:
self
.
data
[
'
exams
'
][
0
].
exam_type_id
})
def
test_can_access
(
self
):
self
.
assertEqual
(
status
.
HTTP_200_OK
,
self
.
response
.
status_code
)
...
...
@@ -180,7 +182,8 @@ class ExportJSONTest(APITestCase):
def
setUp
(
self
):
self
.
client
=
APIClient
()
self
.
client
.
force_login
(
user
=
self
.
data
[
'
reviewers
'
][
0
])
self
.
response
=
self
.
client
.
post
(
'
/api/export/json/
'
)
self
.
response
=
self
.
client
.
post
(
'
/api/export/json/
'
,
data
=
{
'
selected_exam
'
:
self
.
data
[
'
exams
'
][
0
].
exam_type_id
})
def
test_can_access
(
self
):
self
.
assertEqual
(
status
.
HTTP_200_OK
,
self
.
response
.
status_code
)
...
...
@@ -194,8 +197,8 @@ class ExportJSONTest(APITestCase):
self
.
assertEqual
(
''
,
student1
[
'
Name
'
])
self
.
assertEqual
(
''
,
student2
[
'
Name
'
])
self
.
assertEqual
(
'
Test Exam 01
'
,
student1
[
'
Exam
s
'
][
0
][
'
exam
'
][
'
module_reference
'
])
self
.
assertEqual
(
'
Test Exam 01
'
,
student2
[
'
Exam
s
'
][
0
][
'
exam
'
][
'
module_reference
'
])
self
.
assertEqual
(
'
Test Exam 01
'
,
student1
[
'
Exam
'
])
self
.
assertEqual
(
'
Test Exam 01
'
,
student2
[
'
Exam
'
])
self
.
assertEqual
(
'
student01
'
,
student1
[
'
Username
'
])
self
.
assertEqual
(
'
student02
'
,
student2
[
'
Username
'
])
...
...
@@ -203,17 +206,17 @@ class ExportJSONTest(APITestCase):
self
.
assertEqual
(
'
********
'
,
student2
[
'
Password
'
])
self
.
assertEqual
(
'
********
'
,
student1
[
'
Password
'
])
self
.
assertEqual
(
'
01. Sort
'
,
student1
[
'
Scores
'
][
0
][
'
submissions
'
][
0
][
'
type
'
])
self
.
assertEqual
(
'
01. Sort
'
,
student2
[
'
Scores
'
][
0
][
'
submissions
'
][
0
][
'
type
'
])
self
.
assertEqual
(
'
01. Sort
'
,
student1
[
'
Scores
'
][
0
][
'
type
'
])
self
.
assertEqual
(
'
01. Sort
'
,
student2
[
'
Scores
'
][
0
][
'
type
'
])
self
.
assertEqual
(
'
02. Shuffle
'
,
student1
[
'
Scores
'
][
0
][
'
submissions
'
][
1
][
'
type
'
])
self
.
assertEqual
(
'
02. Shuffle
'
,
student2
[
'
Scores
'
][
0
][
'
submissions
'
][
1
][
'
type
'
])
self
.
assertEqual
(
'
02. Shuffle
'
,
student1
[
'
Scores
'
][
1
][
'
type
'
])
self
.
assertEqual
(
'
02. Shuffle
'
,
student2
[
'
Scores
'
][
1
][
'
type
'
])
self
.
assertEqual
(
5
,
student1
[
'
Scores
'
][
0
][
'
submissions
'
][
0
][
'
score
'
])
self
.
assertEqual
(
0
,
student2
[
'
Scores
'
][
0
][
'
submissions
'
][
0
][
'
score
'
])
self
.
assertEqual
(
5
,
student1
[
'
Scores
'
][
0
][
'
score
'
])
self
.
assertEqual
(
0
,
student2
[
'
Scores
'
][
0
][
'
score
'
])
self
.
assertEqual
(
0
,
student2
[
'
Scores
'
][
0
][
'
submissions
'
][
1
][
'
score
'
])
self
.
assertEqual
(
0
,
student2
[
'
Scores
'
][
0
][
'
submissions
'
][
1
][
'
score
'
])
self
.
assertEqual
(
0
,
student2
[
'
Scores
'
][
1
][
'
score
'
])
self
.
assertEqual
(
0
,
student2
[
'
Scores
'
][
1
][
'
score
'
])
class
ExportJSONAndSetPasswordsTest
(
APITestCase
):
...
...
@@ -225,7 +228,8 @@ class ExportJSONAndSetPasswordsTest(APITestCase):
self
.
client
=
APIClient
()
self
.
client
.
force_login
(
user
=
self
.
data
[
'
reviewers
'
][
0
])
self
.
response
=
self
.
client
.
post
(
'
/api/export/json/
'
,
data
=
{
'
setPasswords
'
:
True
})
data
=
{
'
setPasswords
'
:
True
,
'
selected_exam
'
:
self
.
data
[
'
exams
'
][
0
].
exam_type_id
})
def
test_can_access
(
self
):
self
.
assertEqual
(
status
.
HTTP_200_OK
,
self
.
response
.
status_code
)
...
...
This diff is collapsed.
Click to expand it.
core/views/export.py
+
0
−
3
View file @
27c5fd73
...
...
@@ -35,10 +35,7 @@ class StudentJSONExport(APIView):
set_passwords
=
request
.
data
.
get
(
'
set_passwords
'
)
passwords
=
_set_student_passwords
()
if
set_passwords
else
None
selected_exam
=
request
.
data
.
get
(
'
selected_exam
'
)
print
(
"
###### LOG ######
"
)
print
(
selected_exam
)
result
=
ExamType
.
objects
.
get
(
exam_type_id
=
selected_exam
)
print
(
result
.
module_reference
)
content
=
[
{
'
Matrikel
'
:
student
.
matrikel_no
,
'
Name
'
:
student
.
user
.
fullname
,
...
...
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