Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4fde73fa
Commit
4fde73fa
authored
Dec 28, 2015
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address notes.
parent
cb4ed420
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
lms/djangoapps/badges/tests/test_models.py
+9
-7
lms/djangoapps/lms_xblock/test/test_runtime.py
+5
-9
No files found.
lms/djangoapps/badges/tests/test_models.py
View file @
4fde73fa
...
...
@@ -12,8 +12,10 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
badges.models
import
CourseCompleteImageConfiguration
,
validate_badge_image
,
BadgeClass
,
BadgeAssertion
,
\
from
badges.models
import
(
CourseCompleteImageConfiguration
,
validate_badge_image
,
BadgeClass
,
BadgeAssertion
,
CourseBadgesDisabledError
)
from
badges.tests.factories
import
BadgeClassFactory
,
BadgeAssertionFactory
,
RandomBadgeClassFactory
from
certificates.tests.test_models
import
TEST_DATA_ROOT
from
student.tests.factories
import
UserFactory
...
...
@@ -112,12 +114,12 @@ class BadgeClassTest(ModuleStoreTestCase):
exception.
"""
course_key
=
CourseFactory
.
create
(
metadata
=
{
'issue_badges'
:
False
})
.
location
.
course_key
self
.
assertRaises
(
CourseBadgesDisabledError
,
BadgeClass
.
get_badge_class
,
slug
=
'test_slug'
,
issuing_component
=
'test_component'
,
description
=
'Attempted override'
,
criteria
=
'test'
,
display_name
=
'Testola'
,
image_file_handle
=
get_image
(
'good'
),
course_id
=
course_key
,
)
with
self
.
assertRaises
(
CourseBadgesDisabledError
):
BadgeClass
.
get_badge_class
(
slug
=
'test_slug'
,
issuing_component
=
'test_component'
,
description
=
'Attempted override'
,
criteria
=
'test'
,
display_name
=
'Testola'
,
image_file_handle
=
get_image
(
'good'
),
course_id
=
course_key
,
)
def
test_get_badge_class_create
(
self
):
"""
...
...
lms/djangoapps/lms_xblock/test/test_runtime.py
View file @
4fde73fa
...
...
@@ -193,6 +193,7 @@ class TestUserServiceAPI(TestCase):
self
.
runtime
.
service
(
self
.
mock_block
,
'user_tags'
)
.
get_tag
(
'fake_scope'
,
self
.
key
)
@ddt
class
TestBadgingService
(
ModuleStoreTestCase
):
"""Test the badging service interface"""
...
...
@@ -232,17 +233,12 @@ class TestBadgingService(ModuleStoreTestCase):
runtime
=
self
.
create_runtime
()
self
.
assertFalse
(
runtime
.
service
(
self
.
mock_block
,
'badging'
))
@data
(
True
,
False
)
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_OPENBADGES'
:
True
})
def
test_course_badges_disabled
(
self
):
self
.
course_id
=
CourseFactory
.
create
(
metadata
=
{
'issue_badges'
:
False
})
.
location
.
course_key
runtime
=
self
.
create_runtime
()
self
.
assertFalse
(
runtime
.
service
(
self
.
mock_block
,
'badging'
)
.
course_badges_enabled
)
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_OPENBADGES'
:
True
})
def
test_course_badges_enabled
(
self
):
self
.
course_id
=
CourseFactory
.
create
(
metadata
=
{
'issue_badges'
:
True
})
.
location
.
course_key
def
test_course_badges_toggle
(
self
,
toggle
):
self
.
course_id
=
CourseFactory
.
create
(
metadata
=
{
'issue_badges'
:
toggle
})
.
location
.
course_key
runtime
=
self
.
create_runtime
()
self
.
assert
True
(
runtime
.
service
(
self
.
mock_block
,
'badging'
)
.
course_badges_enabled
)
self
.
assert
Is
(
runtime
.
service
(
self
.
mock_block
,
'badging'
)
.
course_badges_enabled
,
toggle
)
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_OPENBADGES'
:
True
})
def
test_get_badge_class
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment