Ayub khan
22c6d45d90
BOM-679
...
Request object was mocked but mocked value was never assigned.
In py2 moked object call is always successful. But in py3 if
value is not properly assigned it returns None. Causing the test
to fail. Removing the mocked object also fails the test so
removing it as broken test.
2019-09-25 14:47:28 +05:00
Feanil Patel
57af13ddc4
Merge pull request #21721 from edx/python3-swarm-2
...
Python3 swarm 2
2019-09-20 08:48:19 -04:00
Awais Qureshi
112a0c7af6
Merge pull request #21694 from edx/awais786/BOM-437
...
BOM-437
2019-09-19 20:03:38 +05:00
Jeremy Bowman
91c87fd65b
Fixed last lms/djangoapps/discussion test failures - BOM-680
2019-09-19 10:38:49 -04:00
Feanil Patel
de0eafa0ba
BOM-618 Decode test client content.
...
The django test client returns bytes, and many of our tests start using
it like a string. This was fine in python 2 but not in python3.
2019-09-18 14:58:30 -04:00
Awais Qureshi
76bead175d
BOM-437
...
Fixing python3
2019-09-18 19:20:06 +05:00
Ayub khan
06c7e3e4e9
BOM-420
...
fixed all file tests
2019-09-13 18:39:00 +05:00
Awais Qureshi
f528e31b76
Merge pull request #21619 from edx/awais786/BOM-416
...
Awais786/bom 416
2019-09-11 19:01:22 +05:00
Ayub
82bddf12ab
Merge pull request #21578 from edx/BOM-106
...
BOM-106
2019-09-11 16:44:27 +05:00
Awais Qureshi
ff98318aa4
BOM-416
...
Fixing python3
2019-09-11 16:04:06 +05:00
Ayub khan
8f65e6923b
BOM-106
...
python3 compatibility
2019-09-11 16:03:58 +05:00
Ayub khan
26d9866bb2
BOM-123
...
Removed broken tests.
2019-09-11 14:24:59 +05:00
Ayub
d6605809cf
Merge pull request #21575 from edx/BOM-336
...
BOM-336
2019-09-06 12:00:23 +05:00
Ayub khan
e02dff1356
BOM-336
...
python3 compatibility: test fix
2019-09-05 16:17:42 +05:00
arbisoft
1f78305f99
This is a combination of 2 commits.
...
This is the 1st commit message:
BOM-149
python3 tests failures.
This is the commit message #2 :
BOM-149
python3 tests failures.
2019-09-05 12:49:06 +05:00
Ayub khan
09beb2c72e
BOM-227
...
python3 compatibility
2019-09-04 14:36:06 +05:00
Ayub khan
da9c71557b
-Remove unicode and use six.text_type
2019-09-02 16:14:02 +05:00
Aarif
4cb616037e
Merge pull request #21464 from edx/BOM-158
...
BOM-158 Python 3 fixes
2019-08-30 11:05:00 +05:00
arbisoft
641ba0215a
BOM-296
...
Fixing python3
2019-08-29 16:58:25 +05:00
aarif
30c61ba907
fixed range function float input failure
...
changes made as suggested
2019-08-29 14:45:45 +05:00
Ayub khan
a7e4a05154
BOM-326
2019-08-23 14:11:30 +05:00
Ayub
85be57b64a
Merge pull request #21397 from edx/BOM-95
...
BOM-95
2019-08-22 12:41:08 +05:00
Feanil Patel
f332b81e4c
Merge pull request #21384 from edx/bom/python-3-swarm
...
Bom/python 3 swarm
2019-08-21 09:27:59 -04:00
Ayub khan
8a95a8e520
BOM-95
...
assertItemsEqual with six.assertCountEqual
2019-08-21 17:01:40 +05:00
Bill DeRusha
aebdf77f8e
Revert "PROD-145: Added validation to discussion topic input in studio, testing 2"
2019-08-20 20:31:15 -04:00
Feanil Patel
73a146fbbe
Revert "assertItemsEqual() moved to assertCountEqual()"
...
This reverts commit 3d2617983b .
The change was not quite right because the method six provides needs to
have `self` be passed in as well. See the docs here:
https://six.readthedocs.io/#unittest-assertions
Reverting for now and we can fix it in smaller chunks later.
2019-08-20 15:31:20 -04:00
Dave St.Germain
3d2617983b
assertItemsEqual() moved to assertCountEqual()
2019-08-19 17:00:17 -04:00
Dave St.Germain
8e725c9eee
Prevent comparison to None
2019-08-19 16:21:28 -04:00
Feanil Patel
68933ec089
Fix quality issues.
2019-08-19 11:51:30 -04:00
Feanil Patel
7a3230a260
Fix another discussions test.
2019-08-19 11:16:26 -04:00
David Ormsbee
9a1385585f
Convert response bytes to str before JSON parsing. ( #21375 )
...
Convert response bytes to str before JSON parsing.
2019-08-19 11:01:55 -04:00
Feanil Patel
65eebe63e7
Hash byte strings.
2019-08-19 11:00:22 -04:00
Feanil Patel
1bfa575ada
Update discussion api tests.
...
json doesn't do any magic with byte strings in python 3. In python 2 it
used to convert str objects to unicode automatically.
2019-08-19 10:48:30 -04:00
Manjinder Singh
65b858e3e7
Merge pull request #21209 from edx/msingh/discussion_topic_validation2
...
PROD-145: Added validation to discussion topic input in studio, testing 2
2019-08-15 19:53:17 -04:00
jinder1s
e7fb13a74f
Added validation to discussion topic input in studio
2019-08-15 16:13:37 -04:00
Feanil Patel
9d7f0ca46e
Get LMS test collection working in python 3.
...
This should be all the changes needed to get test collection working in
python 3 for the `lms` folder.
2019-08-13 16:32:40 -04:00
Calen Pennington
0cd8f58bcc
Remove all instances of from instructor import imports
2019-08-05 09:59:30 -04:00
Feanil Patel
d9c9d7bab9
Deal with NoneType access.
...
The `NoneType` object is not available from the `types` module in
python 3. This is a workaronud to deal with that.
2019-07-19 09:48:10 -04:00
Feanil Patel
729495e1aa
Merge pull request #20871 from amitvadhel/INCR-475
...
Incr 475
2019-06-26 14:51:15 -04:00
Uzair Rasheed
88835c3cc4
Merge pull request #20865 from edx/INCR-478/python-modernize-375-of-380
...
Python-modernize on edx-platform (375 of 380)
2019-06-26 18:57:12 +05:00
Ned Batchelder
b3a731550c
Fix problems that drf-yasg uncovered.
...
These were originally fixed individually, but had to be reverted, and
are now combined in one commit. The originals were:
7b9040f6b0 This enum was backwards
8774ff1f9b Use ref_name to disambiguate serializers that drf-yasg would otherwise assume are the same.
8a44397139 Is this field missing because it is None?
4a1154a7ca Give a safer buffer for clearing the rate limiting
64c47856dd DRF 3.7.4 changed how you delegate to another view, so don't
7359ca4fb2 Is this right? It fixes two tests
fdd66e5390 Adjust the expected error message for DRF 3.7.7
9257f68fd8 The default TIME_ZONE should be UTC
2019-06-21 18:04:15 -04:00
amitvadhel
e304ab0c3f
INCR-475: Make compatible with Python 3.x
2019-06-21 13:41:23 +03:00
uzairr
9835b21191
Python-modernize on edx-platform (375 of 380)
...
After executing python-modernize and isort, few changes occurred in
import sequence as well as unicode func is replaced by six.text_type
func.
INCR-478
2019-06-21 12:15:36 +05:00
usama sadiq
1630911131
Updated to Python3
...
Added absolute import in both files
2019-06-20 16:07:17 +05:00
amitvadhel
05bf848b1f
INCR-477: pylint: disable import-error for urljoin
2019-06-19 09:16:03 +03:00
amitvadhel
94f410f432
INCR-477: Make compatible with Python 3.x
2019-06-19 08:35:43 +03:00
Ned Batchelder
39c7a2db7c
Revert "Use drf-yasg for Open API documentation"
2019-06-11 16:05:00 -04:00
Ned Batchelder
64c47856dd
DRF 3.7.4 changed how you delegate to another view, so don't
...
The error in the test was:
```
AssertionError: The `request` argument must be an instance of `django.http.HttpRequest`, not `rest_framework.request.Request`.
```
The (controversial) incompatible change was in 3.7.4: https://github.com/encode/django-rest-framework/pull/5618
I'll look into whether there's another way to address it.
<details>
<summary>Full error report</summary>
```
AssertionError: The `request` argument must be an instance of `django.http.HttpRequest`, not `rest_framework.request.Request`.
Stacktrace
self = <lms.djangoapps.discussion_api.tests.test_views.CommentViewSetListTest testMethod=test_profile_image_request_for_null_endorsed_by>
def test_profile_image_request_for_null_endorsed_by(self):
"""
Tests if 'endorsed' is True but 'endorsed_by' is null, the api does not crash.
This is the case for some old/stale data in prod/stage environments.
"""
self.register_get_user_response(self.user)
thread = self.make_minimal_cs_thread({
"thread_type": "question",
"endorsed_responses": [make_minimal_cs_comment({
"id": "endorsed_comment",
"user_id": self.user.id,
"username": self.user.username,
"endorsed": True,
})],
"non_endorsed_resp_total": 0,
})
self.register_get_thread_response(thread)
self.create_profile_image(self.user, get_profile_image_storage())
response = self.client.get(self.url, {
"thread_id": thread["id"],
"endorsed": True,
> "requested_fields": "profile_image",
})
lms/djangoapps/discussion_api/tests/test_views.py:1446:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/test.py:291: in get
response = super(APIClient, self).get(path, data=data, **extra)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/test.py:208: in get
return self.generic('GET', path, **r)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/test.py:237: in generic
method, path, data, content_type, secure, **extra)
../venvs/edxapp/local/lib/python2.7/site-packages/django/test/client.py:416: in generic
return self.request(**r)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/test.py:288: in request
return super(APIClient, self).request(**kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/test.py:240: in request
request = super(APIRequestFactory, self).request(**kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/django/test/client.py:501: in request
six.reraise(*exc_info)
../venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/exception.py:41: in inner
response = get_response(request)
../venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py:249: in _legacy_get_response
response = self._get_response(request)
../venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py:187: in _get_response
response = self.process_exception_by_middleware(e, request)
../venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py:185: in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py:185: in inner
return func(*args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py:58: in wrapped_view
return view_func(*args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/viewsets.py:95: in view
return self.dispatch(request, *args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py:494: in dispatch
response = self.handle_exception(exc)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py:491: in dispatch
response = handler(request, *args, **kwargs)
lms/djangoapps/discussion_api/views.py:505: in list
form.cleaned_data["requested_fields"],
lms/djangoapps/discussion_api/api.py:659: in get_comment_list
results = _serialize_discussion_entities(request, context, responses, requested_fields, DiscussionEntity.comment)
lms/djangoapps/discussion_api/api.py:468: in _serialize_discussion_entities
request, results, usernames, discussion_entity_type, include_profile_image
lms/djangoapps/discussion_api/api.py:413: in _add_additional_response_fields
username_profile_dict = _get_user_profile_dict(request, usernames=','.join(usernames))
lms/djangoapps/discussion_api/api.py:350: in _get_user_profile_dict
user_profile_details = AccountViewSet.as_view({'get': 'list'})(request).data
../venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py:58: in wrapped_view
return view_func(*args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/viewsets.py:95: in view
return self.dispatch(request, *args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py:477: in dispatch
request = self.initialize_request(request, *args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/viewsets.py:118: in initialize_request
request = super(ViewSetMixin, self).initialize_request(request, *args, **kwargs)
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py:381: in initialize_request
parser_context=parser_context
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rest_framework.request.Request object at 0x7f597c773890>
request = <rest_framework.request.Request object at 0x7f597fa20f90>
parsers = [<openedx.core.lib.api.parsers.MergePatchParser object at 0x7f59810c32d0>]
authenticators = [<edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication object at 0x7f597c713690>, <openedx.core.lib...rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser object at 0x7f597c773390>]
negotiator = <rest_framework.negotiation.DefaultContentNegotiation object at 0x7f597fa20410>
parser_context = {'args': (), 'kwargs': {}, 'view': <openedx.core.djangoapps.user_api.accounts.views.AccountViewSet object at 0x7f597c7846d0>}
def __init__(self, request, parsers=None, authenticators=None,
negotiator=None, parser_context=None):
assert isinstance(request, HttpRequest), (
'The `request` argument must be an instance of '
'`django.http.HttpRequest`, not `{}.{}`.'
> .format(request.__class__.__module__, request.__class__.__name__)
)
E AssertionError: The `request` argument must be an instance of `django.http.HttpRequest`, not `rest_framework.request.Request`.
../venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/request.py:159: AssertionError
```
</details>
2019-06-10 15:27:39 -04:00
Stu Young
13e624a50b
INCR-307 Run python-modernize on lms/djangoapps/discussion/rest_api ( #20618 )
...
* run python modernize
* run isort
* Fix quality
2019-05-28 12:51:49 -04:00
Jeremy Bowman
ff7292538e
More pylint fixes ( #20692 )
2019-05-28 09:19:31 -04:00