Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Works on my machine
zesje
Commits
55d8d521
Commit
55d8d521
authored
5 years ago
by
Ruben Young On
Browse files
Options
Downloads
Patches
Plain Diff
Fixed tests
parent
c253773e
No related branches found
No related tags found
1 merge request
!16
Add API tests, small fix for MultipleChoiceOption
Pipeline
#17801
failed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/api/test_exams.py
+8
-10
8 additions, 10 deletions
tests/api/test_exams.py
with
8 additions
and
10 deletions
tests/api/test_exams.py
+
8
−
10
View file @
55d8d521
...
...
@@ -45,20 +45,16 @@ def mco_json():
def
add_test_data
():
exam1
=
Exam
(
id
=
1
,
name
=
'
exam 1
'
,
finalized
=
False
)
exam2
=
Exam
(
id
=
2
,
name
=
'
exam 2
'
,
finalized
=
True
)
exam1
=
Exam
(
id
=
3
,
name
=
'
exam 1
'
,
finalized
=
False
)
db
.
session
.
add
(
exam1
)
db
.
session
.
add
(
exam2
)
db
.
session
.
commit
()
problem1
=
Problem
(
id
=
1
,
name
=
'
Problem 1
'
,
exam_id
=
1
)
problem2
=
Problem
(
id
=
2
,
name
=
'
Problem 2
'
,
exam_id
=
2
)
problem1
=
Problem
(
id
=
3
,
name
=
'
Problem 1
'
,
exam_id
=
3
)
db
.
session
.
add
(
problem1
)
db
.
session
.
add
(
problem2
)
db
.
session
.
commit
()
problem_widget_1
=
ProblemWidget
(
id
=
1
,
name
=
'
problem widget
'
,
problem_id
=
1
,
page
=
2
,
problem_widget_1
=
ProblemWidget
(
id
=
3
,
name
=
'
problem widget
'
,
problem_id
=
3
,
page
=
2
,
width
=
100
,
height
=
150
,
x
=
40
,
y
=
200
,
type
=
'
problem_widget
'
)
db
.
session
.
add
(
problem_widget_1
)
db
.
session
.
commit
()
...
...
@@ -72,7 +68,7 @@ def test_get_exams(test_client):
mc_option_1
=
{
'
x
'
:
100
,
'
y
'
:
40
,
'
problem_id
'
:
1
,
'
problem_id
'
:
3
,
'
page
'
:
1
,
'
label
'
:
'
a
'
,
'
name
'
:
'
test
'
...
...
@@ -82,14 +78,16 @@ def test_get_exams(test_client):
mc_option_2
=
{
'
x
'
:
100
,
'
y
'
:
40
,
'
problem_id
'
:
1
,
'
problem_id
'
:
3
,
'
page
'
:
1
,
'
label
'
:
'
a
'
,
'
name
'
:
'
test
'
}
test_client
.
put
(
'
/api/mult-choice/
'
,
data
=
mc_option_2
)
response
=
test_client
.
get
(
'
/api/exams/
1
'
)
response
=
test_client
.
get
(
'
/api/exams/
3
'
)
data
=
json
.
loads
(
response
.
data
)
print
(
data
)
assert
len
(
data
[
'
problems
'
][
0
][
'
mc_options
'
])
==
2
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