Commit Graph

27 Commits

Author SHA1 Message Date
Usama Sadiq
519384edca refactor: ran pyupgrade on lms/djangoapps (#26733)
ran pyupgrade on bulk_enroll & ccx apps.
2021-03-04 16:00:19 +05:00
Aarif
f35ff6a1eb replaced unittest assertions pytest assertions (#26540) 2021-02-18 19:13:47 +05:00
Jawayria
1c9e711054 Applied amnesty to ccx 2021-02-01 18:28:04 +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
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
Stu Young
787868d48b INCR-308 Run python-modernize on lms/djangoapps/ccx/tests (#20617)
* run python modernize

* run isort

* Fix quality
2019-05-21 11:43:22 -04:00
Michael Youngstrom
3221c2b91f Remove lms pytest shards 2019-02-12 11:03:46 -05:00
Jeremy Bowman
ca3316962d TE-2524 Stop using nose.plugins - LMS 1 2018-07-31 13:03:18 -04:00
Stuart Young
1fd2167144 rebalance python unittests onto new shards 2018-05-03 11:16:05 -04:00
Douglas Hall
4d72d9caae Remove use of the deprecated course_structures module. 2018-04-11 12:54:14 -04:00
Andy Armstrong
79acb5c5be Reorder LMS imports using isort 2017-06-11 21:48:06 -04:00
David Ormsbee
2051c90924 Test Speedup: Isolate Modulestore Signals
There are a number of Django Signals that are on the modulestore's
SignalHandler class, such as SignalHandler.course_published. These
signals can trigger very expensive processes to occur, such as course
overview or block structures generation. Most of the time, the test
author doesn't care about these side-effects.

This commit does a few things:

* Converts the signals on SignalHandler to be instances of a new
  SwitchedSignal class, that allows signal sending to be disabled.

* Creates a SignalIsolationMixin helper similar in spirit to the
  CacheIsolationMixin, and adds it to the ModuleStoreIsolationMixin
  (and thus to ModuleStoreTestCase and SharedModuleStoreTestCase).

* Converts our various tests to use this new mechanism. In some cases,
  this means adjusting query counts downwards because they no longer
  have to account for publishing listener actions.

Modulestore generated signals are now muted by default during test runs.
Calls to send() them will result in no-ops. You can choose to enable
specific signals for a given subclass of ModuleStoreTestCase or
SharedModuleStoreTestCase by specifying an ENABLED_SIGNALS class
attribute, like the following example:

    from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase

    class MyPublishTestCase(ModuleStoreTestCase):
        ENABLED_SIGNALS = ['course_published', 'pre_publish']

You should take great care when disabling signals outside of a
ModuleStoreTestCase or SharedModuleStoreTestCase, since they can leak
out into other tests. Be sure to always clean up, and never disable
signals outside of testing. Because signals are essentially process
globals, it can have a lot of unpleasant side-effects if we start
mucking around with them during live requests.

Overall, this change has cut the total test execution time for
edx-platform by a bit over a third, though we still spend a lot in
pre-test setup during our test builds.

[PERF-413]
2017-02-23 10:31:16 -05:00
Calen Pennington
bc20a37c2b Simplify how shards are selected in CI 2016-08-03 16:23:02 -04:00
Ned Batchelder
2e1238b83e Remove unused imports 2016-04-08 11:23:05 -04:00
Amir Qayyum Khan
795ead82b5 Added master course staff and admins to ccx and fixed same issues related to ccx 2016-03-26 03:18:39 +05:00
Giovanni Di Milia
0c637cdca9 Added extra field to CCX model for Course Models
REST APIs modified
2016-02-25 10:27:39 -05:00
Ned Batchelder
f5d0f3ff55 Remove useless pylint suppressions 2015-11-22 07:41:19 -05:00
Usman Khalid
6cb62f2697 Rebase upgrade Django to v1.8.5
Please note that this is a squshed commit and the work of:
Symbolist, macdiesel, nedbat, doctoryes, muzaffaryousaf and muhammad-ammar
2015-11-10 15:00:19 -05:00
Brandon DeRosier
34526ddf6a Revert "Revert "Merge pull request #8986 from jazkarta/remove-ccx-enrollment""
This reverts commit 42e78463a7.
2015-08-11 13:03:58 -04:00
Kyle McCormick
a9c4774fe7 PLA-749 Fix student dashboard for users enrolled in CCX courses 2015-07-20 14:03:50 -04:00
cewing
cb431ccb24 MIT CCX: Use CCX Keys: further revisions in response to code review
only require ccx-keys once

get_current_ccx will now expect a CourseKey instance as its argument, and will raise a value error if this expectation is not met.

document reason for local import

add special methods to pass attribute setting and deletion through to the wrapped modulestore

add __setattr__ and __delattr__ per code review, update __init__ to work with new methods

style change per code review

clean up context manager usage as recommended by code review

remove unused code and imports

convert modulestore type tests to use the `get_modulestore_type` api, remove unused imports

code quality: add docstrings

increase coverage for utils tests

fix bug found in testing.

increase test coverage on modulestore wrapper

code quality fixes

code-quality: ignore import error, but mark site for future consideration
2015-06-12 11:20:30 -07:00
cewing
ef4836503f MIT CCX: Use CCX Keys - responses to code review
remove references to middleware that were missed previously

use key apis rather than local implementation of key conversion.  remove local implementationa

remove spurious test for attribute

fix test setUp to avoid unneeded flattening

code quality fixes

add security check ensuring that the coach is coach for *this* CCX.

prevent ccx/deprecated course id problems

1.  do not allow ccx objects to be created if the course id is deprecated
2.  filter out any ccx memberships that involve deprecated course ids (in case there are bad ccxs in the database)

Fix test failures and errors arising from incorrect code path execution

Create context manager to handle unwrapping and restoring ccx values for the modulestore wrapper, employ it throughout modulestore wrapper implementation
2015-06-12 00:01:24 -07:00
cewing
6a0c9aee9d MIT CCX: Use CCX Keys
Implement the use of CCX opaque keys throughout the ccx code base

include the new custom ccx id package in the github checkouts list

update the coach dashboard wrapper to get CCX information from the incoming course_id, if possible

update function signatures for all view functions to expect CCX as passed by the dashboard wrapper (default to None), remove calls to get_ccx_for_coach as the ccx is passed in.

update reverse calls in python view code to use a CCXLocator for the URL instead of a CourseLocator

use CCXLocator where necessary

use course id to find ccx, instead of thread local

remove unused method and related tests

use course id for getting ccx

provide course id to the get_current_ccx method

ensure the course id passed in is a CourseKey instance of some type whether it starts out as a string or not

use the provided block to figure out what the course_id should be, then get the ccx for that

redirect to ccx dashboard using coach ccx if no ccx is passed in

update student dashboard listing for ccx to build an appropriate url from a CCXLocator, not from the course locator.

refactor building the ccx locator so we don't have to do it repeatedly

begin test refactoring after ccx_keys introduction

Ensure that when access checking happens, the course_locator form of a ccx locator is used.  This ensures that the access check happens against the course and it is not necesarry to duplicate the entire access control structure for the course.

pick up api change in ccx-keys

create and conditionally use a wrapper for the mixed modulestore returned by xmodule.modulestore.django.modulestore

the wrapper will strip and restore ccx values from CourseKey and UsageKey objects

fix return values on a few methods

remove unused symbol

pull updated ccx-keys package

set course_id on the caching descriptor system to avoid api incompatibilities in some subsystems

use ccx.course instead of self.course

fix get method to find course keys from blocks that are not themselves keys but have a location attribute (which will be a key)

if an item coming out of the db has children, restore the ccx to them as well

if the block passed in has a CCX key, unwrap that before we try to look up the override, otherwise it will never be found.

pick up a change in the ccx keys package that allows for stripping CCX identity from a usage key

begin writing tests to cover this modulestore wrapper

remove the switch_pocs view, the url pattern for it, and the tests that covered it

remove the ccx context and the middleware responsible for setting the current CCX.  These are no longer needed

all dashboard views should raise 404 if a ccx is not provided by the coach_dashboard decorator

code quality

prevent errors resulting from trying to `get` a ccx based on non-unique criteria.

remove obsolete usage of ACTIVE_CCX_KEY

fix setUp method for grading tests to properly create grades for the ccx rather than for the course.

clean up reverse calls

code quality

adding docstrings to clarify purpose of this patch

fix bug in getting ccx for coach

fix grading views to properly fetch a ccx-ified course so that grades for that version will be calculated

fix small errors in modulestore implementation

fix errant merge marker

update call to get_current_ccx after key refactoring merged with tab changes
2015-06-12 00:01:24 -07:00
Christine Lytwynec
ddb1ae667e Split lms unittests into multiple shards 2015-05-07 09:17:26 -04:00
Carlos de la Guardia
9ddee93401 MIT: CCX. Code Quality fixes
add doc strings; fix pep8 warning
address some minor issues brought up by the code review process
2015-04-10 23:30:26 -04:00
Carlos de la Guardia
b3da2a54bb MIT: CCX. Fix issues identified in code review
Original Commit Messages:

use edx's own get_parent method, rather than our own.

add field to unique constraint to avoid MultipleObjectsReturned in case of multiple browser clicks on submit

fix 0011 migration, inherit from TimeStampedField and add composite index (migration only)

fix bug where adding an already registered user to a ccx would cause a crash due to an undefined variable

add assertNumQueries tests to test modules where override field providers are used

remove unnecessary teardown

implement recommended style for checking empty list

import utility methods rather than use duplicate code

added comment explaining date conversion to string for json

add logging for invalid users or emails when enrolling students

add comment about xmodule user state

avoid using get_or_create, which seems to be causing a race condition on schedule change save

relocate badly placed edvent handlers to fix multiple submit problem
2015-04-10 23:30:26 -04:00
cewing
7f691e4a92 MIT: CCX. Rename POC to CCX
Final official name is Custom Courses for EdX (CCX), rename all code to remove previous name.

Rename the FEATURE constant used to identify this feature

Rename the middleware for the CCX change

rename the constant used for storing the current poc id on the session.

rename the _PocContext threading local

rename the override provider in all places where it is referenced

`PersonalOnlineCoursesOverrideProvider` -> `CustomCoursesForEdxOverrideProvider`

generally rename symbols from overrides.py to replace `poc` with `ccx` where possible without changing model names or attributes

rename more symbols from poc to ccx
rename util functions from app utils module

general symbol renaming poc -> ccx in views.py and related url changes

Rename the coach role wherever it is used.

reword poc_coach to ccx_coach

UI rename

replace POC with CCX globally

template context variable renamed

rename poc_ to ccx_ in urls and all related locations (views, js, scss etc)

remove pocs migrations

Final massive renaming, including models.  Re-built migration.

cleaning up a few tailing references

Fix reference typo in schedule template JS

undo modifications made on the fly in test setup to ensure that our tests are properly isolated from the rest of the system tests.

Fixes jazkarta/edx-platform#38

Clean up some leftover strings and comments

fixing more strings and comments in python files

fix a naming error in the schedule tab that was causing problems in deleting courseware items.

Fixes jazkarta/edx-platform#36

updating tests and utility code to match changes in infrastructure from latest rebase
2015-04-10 23:30:25 -04:00