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
Merge requests
!56
Added an export endpoint that produces a CSV file
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Added an export endpoint that produces a CSV file
export-csv-results
into
master
Overview
0
Commits
1
Pipelines
1
Changes
6
Merged
Jan Maximilian Michal
requested to merge
export-csv-results
into
master
7 years ago
Overview
0
Commits
1
Pipelines
1
Changes
6
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
38c42d20
1 commit,
7 years ago
6 files
+
133
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
core/tests/test_export.py
0 → 100644
+
86
−
0
Options
from
rest_framework
import
status
from
django.test
import
TestCase
,
Client
from
util.factories
import
make_test_data
class
ExportCSVTest
(
TestCase
):
@classmethod
def
setUpTestData
(
cls
):
cls
.
data
=
make_test_data
(
data_dict
=
{
'
submission_types
'
:
[
{
'
name
'
:
'
01. Sort
'
,
'
full_score
'
:
35
,
'
description
'
:
'
Very complicated
'
,
'
solution
'
:
'
Trivial!
'
},
{
'
name
'
:
'
02. Shuffle
'
,
'
full_score
'
:
35
,
'
description
'
:
'
Very complicated
'
,
'
solution
'
:
'
Trivial!
'
}
],
'
students
'
:
[
{
'
username
'
:
'
student01
'
},
{
'
username
'
:
'
student02
'
}
],
'
reviewers
'
:
[
{
'
username
'
:
'
reviewer
'
}
],
'
submissions
'
:
[
{
'
text
'
:
'
function blabl
\n
'
'
on multi lines
\n
'
'
for blabla in bla:
\n
'
'
lorem ipsum und so
\n
'
,
'
type
'
:
'
01. Sort
'
,
'
user
'
:
'
student01
'
,
'
feedback
'
:
{
'
score
'
:
5
,
'
is_final
'
:
True
,
'
feedback_lines
'
:
{
'
1
'
:
[{
'
text
'
:
'
This is very bad!
'
,
'
of_tutor
'
:
'
reviewer
'
}],
}
}
},
{
'
text
'
:
'
not much
'
,
'
type
'
:
'
02. Shuffle
'
,
'
user
'
:
'
student01
'
},
{
'
text
'
:
'
function blabl
\n
'
'
asasxasx
\n
'
'
lorem ipsum und so
\n
'
,
'
type
'
:
'
01. Sort
'
,
'
user
'
:
'
student02
'
},
{
'
text
'
:
'
not much to see here
'
,
'
type
'
:
'
02. Shuffle
'
,
'
user
'
:
'
student02
'
}
]}
)
def
setUp
(
self
):
client
=
Client
()
client
.
force_login
(
user
=
self
.
data
[
'
reviewers
'
][
0
])
self
.
response
=
client
.
get
(
'
/export/csv/
'
)
def
test_can_access
(
self
):
self
.
assertEqual
(
status
.
HTTP_200_OK
,
self
.
response
.
status_code
)
def
test_data_is_correct
(
self
):
head
,
student1
,
student2
,
_
=
self
.
response
.
content
.
split
(
b
'
\r\n
'
)
self
.
assertIn
(
b
'
Matrikel,Username,Name,Sum,01. Sort,02. Shuffle
'
,
head
)
self
.
assertIn
(
b
'
student01,,5,5,0
'
,
student1
)
self
.
assertIn
(
b
'
student02,,0,0,0
'
,
student2
)
Loading