Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
a7d81f88
Commit
a7d81f88
authored
Sep 28, 2016
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed pylint was not checking the files under publisher/tests and publisher_comments/tests.
ECOM-5845
parent
42b60c19
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
10 deletions
+15
-10
course_discovery/apps/publisher/tests/__init__.py
+0
-0
course_discovery/apps/publisher/tests/factories.py
+2
-1
course_discovery/apps/publisher/tests/test_views.py
+6
-5
course_discovery/apps/publisher/tests/test_wrapper.py
+2
-1
course_discovery/apps/publisher_comments/tests/__init__.py
+0
-0
course_discovery/apps/publisher_comments/tests/factories.py
+1
-1
course_discovery/apps/publisher_comments/tests/test_admin.py
+2
-1
course_discovery/apps/publisher_comments/tests/test_views.py
+2
-1
No files found.
course_discovery/apps/publisher/tests/__init__.py
0 → 100644
View file @
a7d81f88
course_discovery/apps/publisher/tests/factories.py
View file @
a7d81f88
from
datetime
import
datetime
import
factory
from
django.contrib.auth.models
import
Group
import
factory
from
factory.fuzzy
import
FuzzyText
,
FuzzyChoice
,
FuzzyDecimal
,
FuzzyDateTime
,
FuzzyInteger
from
pytz
import
UTC
...
...
course_discovery/apps/publisher/tests/test_views.py
View file @
a7d81f88
# pylint: disable=no-member
import
ddt
from
mock
import
patch
from
django.conf
import
settings
...
...
@@ -647,10 +648,10 @@ class CourseRunDetailTests(TestCase):
def
_assert_dates
(
self
,
response
):
""" Helper method to test all dates. """
for
value
in
[
self
.
course_run
.
start
,
self
.
course_run
.
end
,
self
.
course_run
.
enrollment_start
,
self
.
course_run
.
enrollment_end
]:
for
value
in
[
self
.
course_run
.
start
,
self
.
course_run
.
end
,
self
.
course_run
.
enrollment_start
,
self
.
course_run
.
enrollment_end
]:
self
.
assertContains
(
response
,
value
.
strftime
(
self
.
date_format
))
def
_assert_subjects
(
self
,
response
):
...
...
@@ -681,7 +682,7 @@ class CourseRunDetailTests(TestCase):
""" Verify that `ViewPermissionMixin.get_course` return none
if `publisher_object` doesn't have `course` attr.
"""
non_staff_user
,
group
=
create_non_staff_user_and_login
(
self
)
non_staff_user
,
group
=
create_non_staff_user_and_login
(
self
)
# pylint: disable=unused-variable
page_url
=
reverse
(
'publisher:publisher_course_run_detail'
,
args
=
[
self
.
course_run
.
id
])
with
patch
.
object
(
CourseRunDetailView
,
'get_object'
,
return_value
=
non_staff_user
):
response
=
self
.
client
.
get
(
page_url
)
...
...
course_discovery/apps/publisher/tests/test_wrapper.py
View file @
a7d81f88
# pylint: disable=no-member
import
ddt
from
unittest
import
mock
from
django.test
import
TestCase
import
ddt
from
course_discovery.apps.course_metadata.tests.factories
import
OrganizationFactory
from
course_discovery.apps.publisher.models
import
Seat
,
State
from
course_discovery.apps.publisher.tests
import
factories
...
...
course_discovery/apps/publisher_comments/tests/__init__.py
0 → 100644
View file @
a7d81f88
course_discovery/apps/publisher_comments/tests/factories.py
View file @
a7d81f88
...
...
@@ -17,7 +17,7 @@ class CommentFactory(factory.DjangoModelFactory):
comment
=
FuzzyText
(
prefix
=
"Test Comment for çօմɾʂҽ"
)
content_object
=
factory
.
SubFactory
(
CourseRunFactory
)
user
=
UserFactory
(
)
user
=
factory
.
SubFactory
(
UserFactory
)
site
=
factory
.
SubFactory
(
SiteFactory
)
class
Meta
:
...
...
course_discovery/apps/publisher_comments/tests/test_admin.py
View file @
a7d81f88
...
...
@@ -21,6 +21,7 @@ class AdminTests(TestCase):
def
test_comment_detail_form
(
self
):
""" Verify in admin panel comment detail form contain the custom modified field. """
# pylint: disable=no-member
resp
=
self
.
client
.
get
(
reverse
(
'admin:publisher_comments_comments_change'
,
args
=
(
self
.
comment
.
id
,)))
self
.
assertContains
(
resp
,
'modified'
)
...
...
@@ -28,6 +29,6 @@ class AdminTests(TestCase):
""" Verify in admin panel for comments loads only three models in content type drop down. """
form
=
CommentsAdminForm
(
instance
=
self
.
comment
)
self
.
assertListEqual
(
sorted
([
con
.
model
for
con
in
form
.
fields
[
'content_type'
]
.
_queryset
]),
sorted
([
con
.
model
for
con
in
form
.
fields
[
'content_type'
]
.
_queryset
]),
# pylint: disable=protected-access
sorted
([
'courserun'
,
'seat'
,
'course'
])
)
course_discovery/apps/publisher_comments/tests/test_views.py
View file @
a7d81f88
...
...
@@ -10,6 +10,7 @@ from course_discovery.apps.publisher.tests import factories
from
course_discovery.apps.publisher_comments.tests.factories
import
CommentFactory
# pylint: disable=no-member
class
CommentsTests
(
TestCase
):
""" Tests for the Comment functionality on `Courser`, `CourseRun` And `Seat` edit pages. """
def
setUp
(
self
):
...
...
@@ -43,7 +44,7 @@ class CommentsTests(TestCase):
self
.
assertContains
(
response
,
'Total Comments 0'
)
comments
=
[]
for
num
in
range
(
1
,
10
):
for
num
in
range
(
1
,
10
):
# pylint: disable=unused-variable
comments
.
append
(
self
.
_generate_comment
(
content_object
=
content_object
,
user
=
self
.
user
))
response
=
self
.
client
.
get
(
reverse
(
page_path
,
kwargs
=
{
'pk'
:
content_object
.
id
}))
for
comment
in
comments
:
...
...
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