Commit Graph

38 Commits

Author SHA1 Message Date
Usama Sadiq
82406e970a reafctor: ran pyupgrade on lms/djangoapps/courseware (#26739) 2021-03-12 14:43:44 +05:00
Aarif
0112339b20 replaced unittest assertions pytest assertions (#26543) 2021-02-19 11:58:27 +05:00
Jawayria
03e6a874d0 Applied pylint-amnesty to courseware 2021-02-03 21:56:24 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Aarif
98af9ce418 remove useless-supression warnings 2020-05-01 19:42:15 +05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Feanil Patel
802929fde4 BOM-622 Type errors in content matching. 2019-09-19 16:18:23 -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
alangsto
4a1346b068 INCR-265 Run python-modernize on lms/djangoapps/courseware/management and lms/djangoapps/courseware/tests (#20716)
* updated files according to INCR-265

* fixed docstring and line-length problems from quality test

* Revert "fixed docstring and line-length problems from quality test"

This reverts commit d050f55a4ecfaa38f46b80ec4bb85ff399a79a8c.

* fixed errors reported in quality report

* had error, fixed it

* reversed change

* fixed over/under indentation, and added line to import.py that Ned had suggested

* tried disabling pylint for this line

* testing new email

* testing email in different window

* re-added symlink and docstring
2019-05-31 14:07:18 -04:00
Michael Youngstrom
3221c2b91f Remove lms pytest shards 2019-02-12 11:03:46 -05:00
Matthew Piatetsky
6e81c84d8b fix unicode strings in lms/ part 1 2019-02-05 15:15:02 -05:00
Stuart Young
0dd13fad1b add paver timeout decorator and npm installation logs 2018-09-07 08:46:04 -04:00
Michael Youngstrom
bc1d883e1a Dont let DarkLangConfig cache interfere with other tests 2018-09-06 10:33:54 -04:00
Jeremy Bowman
4e8668d3be TE-2524 Stop using nose.plugins - LMS 2 2018-08-01 13:54:06 -04:00
Eric Fischer
247bb50ed2 s/django.core.urlresolvers/django.urls/g
Django 1.10 deprecation fix for Hackathon XIX
Addresses PLAT-1397
2018-06-05 13:59:09 -04:00
bmedx
f3f8d8ec96 Changes necessary for Django 1.11 tests to start
- Certificates management commands updates
- Moving reverse calls in tests into setUp from class definition
- Import shuffling
- Consolidating cryptograhpy version to 1.9
2017-11-13 15:45:32 -05:00
Andy Armstrong
82f7d6ee64 Convert /update_lang/ page to use Bootstrap
LEARNER-1922
2017-08-18 16:15:38 -04:00
Calen Pennington
33fee20c3a Reapply "Merge pull request #14868 from cpennington/learner-542"
This reverts commit 65f13ddec4.
2017-04-27 09:25:02 -04:00
Calen Pennington
65f13ddec4 Revert "Merge pull request #14868 from cpennington/learner-542"
This reverts commit 88dd85caec, reversing
changes made to bf8aef33fc.
2017-04-26 11:29:56 -04:00
Calen Pennington
4d21fbe6b9 Use UserFactory.create so that it creates a UserProfile for the user 2017-04-24 07:37:19 -04:00
Calen Pennington
e733179d49 Store Learner language preferences into a cookie rather than the session
This modifies the lang-pref django app to:
a) Use the current value of the 'edx-language-preference' cookie to set the
   users Accept-Language header on an incoming request.
b) At the end of the request, update the 'edx-language-preference' cookie
   to reflect the users current Language Preference choice, if any.

[LEARNER-542]
2017-04-24 07:37:19 -04:00
Ahsan Ulhaq
04ca94eaef Account settings page should load and create student user profile
ECOM-4776
2017-04-13 11:47:38 +05:00
Andy Armstrong
4d4097e13c Move dark_lang and lang_pref apps to openedx/core 2016-10-13 11:56:24 -04:00
Calen Pennington
bc20a37c2b Simplify how shards are selected in CI 2016-08-03 16:23:02 -04:00
Albert St. Aubin
b42a7a1cfb Removed the Darklang preview-lang and clear-lang parameters and added the new DarkLang settings form at /update_lang
Remove the DarkLang middleware from the LMS

Created and basic routing to the update_lang page for the GET Request
TNL-4742

Basic form functionality

Working example in LMS of the form to set the language

Login now required to change the preview language, and corrected some minor bugs

Updates to move the template code to lms and to correct minor defects
TNL-4742

Added template for preview_lang.html to cms
TNL-4742

Changed filename of darklang.py to api.py to match convention
TNL-4742

Updated and refactored the Darklang tests
TNL-4742

Updated comments in tests
TNL-4742

Formating updates
TNL-4742

Updated comments and formatting
TNL-4742

Corrected i18n tests and corrected PEP8 format issues
TNL-4742

Code Lint/PEP-8 corrections and upates
TNL-4742

Removed constant that was not needed (to be squashed)
TNL-4742

Added init method to clear up PEP8 Warnings (will squash)
TNL-4742

PEP-8/Lint issue resolved (squash)

Updated for i18n
TNL-4742

Refactored the preview_lang.html page to use a common included template

Refactoring and changes from PR comments
TNL-4742

Correction for safecommit violation (Squash)
TNL-4742

PR changes and refactoring (Squash)

Updates to reduce changes made in the urls used
TNL-4742

Removed unneeded aria-described by and bug in MAKO Template (squash)
TNK-4742

Updated docstring comments

Clarified form response text

Minor PR request (Squash)

Refactoring of how the responses are generated within the DarkLang views file

A series of refactors in response to PR comments

Method name change for clarity in reponse to PR comments (Squash)

Updates to tests per PR requests (Squash)

Minor comment updates for clarity and PR requests (Squash)

Updated per PR comments and added a test for empty preview_language

Layout and code style updates (Squash)

Updated test to contain method in the request.

Removed the Darklang preview-lang and clear-lang parameters and added the new DarkLang settings form at /update_lang

Refactored tests and added some tests for coverage, corrected defect with empty input codes

Removed unused and obsolete code

Corrected test errors, resolved PR comments, and updated comments to clarify testing
TNL-4742

Updated tests to deal with Pylint quality issue (Squash)

Updated tests to better reflect test case and PR updates (Squash)
2016-07-27 10:43:08 -04:00
Calen Pennington
6963c5307b Deactivate translations after all i18n tests in courseware so that they don't leak to future tests 2016-06-02 11:06:59 -04:00
Kevin Falcone
6f9a3911e5 Implement a BaseStudentModuleHistory
This abstract class contains most of the fields (aside from the id and
foreign key to StudentModule that the subclasses need to manage).  It
also provides a get_history method that abstracts searching across
multiple backends.

Move router code to openedx/core
We need to use it from cms and lms.
Ensure aws_migrate can be used for migrating both the lms and cms.

Handle queries directed to student_module_history vs default and the
extra queries generated by Django 1.8 (SAVEPOINTS, etc).

Additionally, flag testing classes as multi_db so that Django will
flush the non-default database between unit tests.

Further decouple the foreignkey relation between csm and csmhe

When calling StudentModule().delete() Django will try to delete CSMHE
objects, but naively does so in the database, not by consulting the
database router.

Instead, we disable django cascading deletes and listen for post_delete
signals and clean up CSMHE by hand.

Add feature flags for CSMHE
One to turn it on/off so we can control the deploy.
The other will control whether or not we read from two database tables
or one when searching.

Update tests to explicitly use this get_history method rather than
looking directly into StudentModuleHistory or
StudentModuleHistoryExtended.

Inform lettuce to avoid the coursewarehistoryextended app

Otherwise it fails when it can't find features/ in that app.

Add Pg support, this is not tested automatically.
2016-02-29 13:59:27 -05:00
Sarina Canelake
9f46d9f0c5 Regression test: dark lang stays set through multiple pages 2015-06-26 13:15:44 -04:00
Sarina Canelake
cf80c96f0b Add i18n roundtrip regression tests for language pref and dark lang
Tests would have caught issues raised in LOC-87
2015-06-26 13:15:44 -04:00
Sarina Canelake
5fcdafd0cf Add i18n regression tests (LOC-72, LOC-85) 2015-06-26 13:15:42 -04:00
Ned Batchelder
eb3b8c5ce4 TNL-2269 Compute language direction every time.
The old code would compute the language direction once when the template
was loaded.

TNL-2269
2015-05-28 16:13:59 -04:00
Christine Lytwynec
ddb1ae667e Split lms unittests into multiple shards 2015-05-07 09:17:26 -04:00
Ned Batchelder
7d799e34f3 Remove unused imports 2015-03-17 07:10:31 -04:00
Calen Pennington
b353ed2ea2 Better support specifying of modulestore configuration in test cases
The existing pattern of using `override_settings(MODULESTORE=...)` prevented
us from having more than one layer of subclassing in modulestore tests.

In a structure like:

    @override_settings(MODULESTORE=store_a)
    class BaseTestCase(ModuleStoreTestCase):
        def setUp(self):
            # use store

    @override_settings(MODULESTORE=store_b)
    class ChildTestCase(BaseTestCase):
        def setUp(self):
            # use store

In this case, the store actions performed in `BaseTestCase` on behalf of
`ChildTestCase` would still use `store_a`, even though the `ChildTestCase`
had specified to use `store_b`. This is because the `override_settings`
decorator would be the innermost wrapper around the `BaseTestCase.setUp` method,
no matter what `ChildTestCase` does.

To remedy this, we move the call to `override_settings` into the
`ModuleStoreTestCase.setUp` method, and use a cleanup to remove the override.
Subclasses can just defined the `MODULESTORE` class attribute to specify which
modulestore to use _for the entire `setUp` chain_.

[PLAT-419]
2015-02-04 09:09:14 -05:00
Jesse Zoldak
bf3b87bc64 Clean up all modulestore testcases
Move modulestore config for tests to an importable location
Disable pylnt warning for lms imports in common tests
Refactor all testcases that loaded all xml courses
TE-610
TE-489
2014-12-02 07:09:36 -05:00
Frances Botsford
e255ac1f29 Initial pass at LMS and Studio RTL 2014-10-17 13:51:42 -04:00
Dave St.Germain
6d50ff7b61 Set the html language to the browser's specified language 2014-01-28 16:43:29 -05:00