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
79d81052
Commit
79d81052
authored
2 years ago
by
Jakob Dieterle
Browse files
Options
Downloads
Patches
Plain Diff
clean up for flake8
parent
b7ff91dc
No related branches found
Branches containing commit
No related tags found
1 merge request
!244
Resolve "Make exam a many to many field on StudentInfo model"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
functional_tests/multiple_exams_test.py
+0
-183
0 additions, 183 deletions
functional_tests/multiple_exams_test.py
with
0 additions
and
183 deletions
functional_tests/multiple_exams_test.py
deleted
100644 → 0
+
0
−
183
View file @
b7ff91dc
from
selenium.webdriver.common.keys
import
Keys
from
selenium.webdriver.support
import
expected_conditions
as
ec
from
selenium.webdriver.support.ui
import
WebDriverWait
from
constance.test
import
override_config
from
core.models
import
UserAccount
from
util.factories
import
make_test_data
,
make_exams
from
functional_tests.util
import
GradyTestCase
,
reset_browser_after_test
from
time
import
sleep
class
multipleExamsTest
(
GradyTestCase
):
def
setUp
(
self
):
exams
=
make_exams
([{
'
module_reference
'
:
'
Test Exam 01
'
,
'
total_score
'
:
100
,
'
pass_score
'
:
60
,
},{
'
module_reference
'
:
'
Test Exam 02
'
,
'
total_score
'
:
120
,
'
pass_score
'
:
75
}]
)
self
.
test_data
=
make_test_data
(
data_dict
=
{
'
exams
'
:
[{
'
module_reference
'
:
'
Test Exam 01
'
,
'
total_score
'
:
100
,
'
pass_score
'
:
60
,
'
exam_type_id
'
:
exams
[
0
].
exam_type_id
},{
'
module_reference
'
:
'
Test Exam 02
'
,
'
total_score
'
:
120
,
'
pass_score
'
:
75
,
'
exam_type_id
'
:
exams
[
1
].
exam_type_id
}],
'
submission_types
'
:
[
{
'
name
'
:
'
01. Sort this or that
'
,
'
full_score
'
:
35
,
'
description
'
:
'
Very complicated
'
,
'
solution
'
:
'
Trivial!
'
,
'
exam_type
'
:
exams
[
0
]
},
{
'
name
'
:
'
02. Merge this or that or maybe even this
'
,
'
full_score
'
:
35
,
'
description
'
:
'
Very complicated
'
,
'
solution
'
:
'
Trivial!
'
,
'
exam_type
'
:
exams
[
0
]
},
{
'
name
'
:
'
05
'
,
'
full_score
'
:
35
,
'
description
'
:
'
It is not a story the jedi would tell you
'
,
'
solution
'
:
'
Trivial!
'
,
'
exam_type
'
:
exams
[
1
]
}
],
'
students
'
:
[
{
'
username
'
:
'
student01
'
,
'
password
'
:
'
p
'
,
'
exam
'
:
'
Test Exam 01
'
},
{
'
username
'
:
'
student02
'
,
'
password
'
:
'
p
'
,
'
exam
'
:
'
Test Exam 01
'
},
{
'
username
'
:
'
student03
'
,
'
password
'
:
'
p
'
,
'
exam
'
:
'
Test Exam 02
'
},
{
'
username
'
:
'
student04
'
,
'
password
'
:
'
p
'
,
'
exam
'
:
'
Test Exam 02
'
}
],
'
tutors
'
:
[
{
'
username
'
:
'
tutor01
'
,
'
password
'
:
'
p
'
},
{
'
username
'
:
'
tutor02
'
,
'
password
'
:
'
p
'
}
],
'
reviewers
'
:
[
{
'
username
'
:
'
reviewer
'
,
'
password
'
:
'
p
'
}
],
'
submissions
'
:
[
{
'
text
'
:
'
function blabl
\n
'
'
on multi lines
\n
'
'
for blabla in bla:
\n
'
'
lorem ipsum und so
\n
'
,
'
type
'
:
'
01. Sort this or that
'
,
'
user
'
:
'
student01
'
,
'
feedback
'
:
{
'
score
'
:
5
,
'
is_final
'
:
True
,
'
feedback_lines
'
:
{
'
1
'
:
[{
'
text
'
:
'
This is very bad!
'
,
'
of_tutor
'
:
'
tutor01
'
}],
}
}
},
{
'
text
'
:
'
function blabl
\n
'
'
asasxasx
\n
'
'
lorem ipsum und so
\n
'
,
'
type
'
:
'
02. Merge this or that or maybe even this
'
,
'
user
'
:
'
student01
'
},
{
'
text
'
:
'
function blabl
\n
'
'
on multi lines
\n
'
'
asasxasx
\n
'
'
lorem ipsum und so
\n
'
,
'
type
'
:
'
01. Sort this or that
'
,
'
user
'
:
'
student02
'
},
{
'
text
'
:
'
function lorem ipsum etc
\n
'
,
'
type
'
:
'
02. Merge this or that or maybe even this
'
,
'
user
'
:
'
student02
'
}
]}
)
def
tearDown
(
self
):
self
.
saveScreenshots
()
reset_browser_after_test
(
self
.
browser
,
self
.
live_server_url
)
def
test_dummy
(
self
):
reviewer
=
self
.
test_data
[
'
reviewers
'
][
0
]
self
.
_login
(
reviewer
)
self
.
assertTrue
(
self
.
browser
.
current_url
.
endswith
(
'
#/exam_selection
'
))
def
_login
(
self
,
account
):
self
.
browser
.
get
(
self
.
live_server_url
)
username_input
=
self
.
browser
.
find_element_by_xpath
(
'
//input[@id=
"
username
"
]
'
)
username_input
.
send_keys
(
account
.
username
)
password_input
=
self
.
browser
.
find_element_by_xpath
(
'
//input[@id=
"
password
"
]
'
)
password_input
.
send_keys
(
'
p
'
)
self
.
browser
.
find_element_by_xpath
(
'
//button[@type=
"
submit
"
]
'
).
send_keys
(
Keys
.
ENTER
)
WebDriverWait
(
self
.
browser
,
10
).
until
(
ec
.
url_contains
(
'
/exam_selection
'
))
def
test_selection_of_exams
(
self
):
testBool
=
True
reviewer
=
self
.
test_data
[
'
reviewers
'
][
0
]
self
.
_login
(
reviewer
)
items
=
self
.
browser
.
find_elements_by_id
(
"
listItem
"
)
for
i
in
range
(
len
(
items
)):
itemText
=
items
[
i
].
text
items
[
i
].
click
()
testBool
=
itemText
==
self
.
browser
.
find_element_by_class_name
(
"
title
"
).
text
if
(
testBool
!=
True
):
break
self
.
browser
.
find_element_by_id
(
"
examsButton
"
).
click
()
items
=
self
.
browser
.
find_elements_by_id
(
"
listItem
"
)
self
.
assertTrue
(
testBool
)
def
test_check_students
(
self
):
students_on_file
=
0
for
student
in
self
.
test_data
[
'
students
'
]:
print
(
student
.
student
.
exams
.
all
()[
0
].
exam
)
if
str
(
student
.
student
.
exams
.
all
()[
0
].
exam
)
==
'
Test Exam 01
'
:
students_on_file
+=
1
print
(
students_on_file
)
reviewer
=
self
.
test_data
[
'
reviewers
'
][
0
]
self
.
_login
(
reviewer
)
self
.
browser
.
find_element_by_id
(
"
listItem
"
).
click
()
self
.
browser
.
find_element_by_xpath
(
'
//*[contains(text(),
"
Participants
"
)]
'
).
click
()
sleep
(
10
)
students
=
self
.
browser
.
find_elements_by_class_name
(
"
participant
"
)
print
(
len
(
students
))
self
.
assertTrue
(
students_on_file
==
students
)
\ No newline at end of file
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