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
0a0a3f3a
There was a problem fetching the pipeline summary.
Commit
0a0a3f3a
authored
7 years ago
by
robinwilliam.hundt
Browse files
Options
Downloads
Patches
Plain Diff
removed get_exam_module view
parent
ec823496
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!23
Resolve "Logout of tutors after inactivity"
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/tests/test_functional_views.py
+1
-18
1 addition, 18 deletions
core/tests/test_functional_views.py
core/urls.py
+0
-1
0 additions, 1 deletion
core/urls.py
core/views.py
+0
-11
0 additions, 11 deletions
core/views.py
with
1 addition
and
30 deletions
core/tests/test_functional_views.py
+
1
−
18
View file @
0a0a3f3a
from
django.urls
import
reverse
from
rest_framework.test
import
(
APIRequestFactory
,
APITestCase
,
force_authenticate
)
from
core.models
import
ExamType
from
core.views
import
get_exam_module
,
get_user_role
from
core.views
import
get_user_role
from
util.factories
import
GradyUserFactory
...
...
@@ -32,19 +31,3 @@ class GetUserRoleTest(APITestCase):
force_authenticate
(
self
.
request
,
user
=
self
.
reviewer
.
user
)
response
=
get_user_role
(
self
.
request
)
self
.
assertEqual
(
response
.
data
[
'
role
'
],
'
Reviewer
'
)
class
GetExamModuleTest
(
APITestCase
):
def
test_get_exam_module
(
self
):
self
.
factory
=
APIRequestFactory
()
self
.
user
=
GradyUserFactory
().
make_student
().
user
self
.
request
=
self
.
factory
.
get
(
reverse
(
'
exam-module
'
))
force_authenticate
(
self
.
request
,
user
=
self
.
user
)
self
.
expected
=
ExamType
.
objects
.
get_or_create
(
pk
=
1
,
defaults
=
{
'
module_reference
'
:
'
Test Exam
'
,
'
total_score
'
:
100
,
'
pass_score
'
:
50
,
})[
0
].
module_reference
self
.
response
=
get_exam_module
(
self
.
request
)
self
.
assertEqual
(
self
.
response
.
data
[
'
exam
'
],
self
.
expected
)
This diff is collapsed.
Click to expand it.
core/urls.py
+
0
−
1
View file @
0a0a3f3a
...
...
@@ -17,7 +17,6 @@ router.register(r'tutor', views.TutorApiViewSet)
regular_views_urlpatterns
=
[
url
(
r
'
student-page
'
,
views
.
StudentSelfApiView
.
as_view
(),
name
=
'
student-page
'
),
url
(
r
'
user-role
'
,
views
.
get_user_role
,
name
=
'
user-role
'
),
url
(
r
'
exam-module
'
,
views
.
get_exam_module
,
name
=
'
exam-module
'
),
url
(
r
'
jwt-time-delta
'
,
views
.
get_jwt_expiration_delta
,
name
=
'
jwt-time-delta
'
)
]
...
...
This diff is collapsed.
Click to expand it.
core/views.py
+
0
−
11
View file @
0a0a3f3a
...
...
@@ -23,17 +23,6 @@ def get_user_role(request):
return
Response
({
'
role
'
:
type
(
request
.
user
.
get_associated_user
()).
__name__
})
@api_view
()
def
get_exam_module
(
request
):
"""
Returns the module_reference of the first ExamType instance.
"""
# At the moment this solution is sufficient, since there is only one exam
# in the database at any one moment
if
ExamType
.
objects
.
count
()
>
0
:
return
Response
({
'
exam
'
:
ExamType
.
objects
.
get
(
pk
=
1
).
module_reference
})
else
:
return
Response
({
'
exam
'
:
'
No exam available
'
})
class
StudentSelfApiView
(
generics
.
RetrieveAPIView
):
"""
Gets all data that belongs to one student
"""
permission_classes
=
(
IsStudent
,)
...
...
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