Commit d827d47b by bmedx

Tag LMS Unit 2 tests that fail in Django 1.11

parent aa0377b0
""" """
Tests use cases related to LMS Entrance Exam behavior, such as gated content access (TOC) Tests use cases related to LMS Entrance Exam behavior, such as gated content access (TOC)
""" """
import pytest
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from mock import Mock, patch
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from courseware.entrance_exams import ( from courseware.entrance_exams import (
course_has_entrance_exam, course_has_entrance_exam,
...@@ -12,10 +17,7 @@ from courseware.model_data import FieldDataCache ...@@ -12,10 +17,7 @@ from courseware.model_data import FieldDataCache
from courseware.module_render import get_module, handle_xblock_callback, toc_for_course from courseware.module_render import get_module, handle_xblock_callback, toc_for_course
from courseware.tests.factories import InstructorFactory, StaffFactory, UserFactory from courseware.tests.factories import InstructorFactory, StaffFactory, UserFactory
from courseware.tests.helpers import LoginEnrollmentTestCase from courseware.tests.helpers import LoginEnrollmentTestCase
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from milestones.tests.utils import MilestonesTestCaseMixin from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
from openedx.core.djangolib.testing.utils import get_mock_request from openedx.core.djangolib.testing.utils import get_mock_request
...@@ -37,6 +39,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory ...@@ -37,6 +39,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr(shard=2) @attr(shard=2)
@patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True}) @patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True})
@pytest.mark.django111_expected_failure
class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTestCaseMixin): class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTestCaseMixin):
""" """
Check that content is properly gated. Check that content is properly gated.
......
...@@ -11,6 +11,7 @@ from urllib import quote, urlencode ...@@ -11,6 +11,7 @@ from urllib import quote, urlencode
from uuid import uuid4 from uuid import uuid4
import ddt import ddt
import pytest
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse, reverse_lazy from django.core.urlresolvers import reverse, reverse_lazy
...@@ -206,6 +207,7 @@ class TestJumpTo(ModuleStoreTestCase): ...@@ -206,6 +207,7 @@ class TestJumpTo(ModuleStoreTestCase):
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@pytest.mark.django111_expected_failure
class IndexQueryTestCase(ModuleStoreTestCase): class IndexQueryTestCase(ModuleStoreTestCase):
""" """
Tests for query count. Tests for query count.
...@@ -248,6 +250,7 @@ class IndexQueryTestCase(ModuleStoreTestCase): ...@@ -248,6 +250,7 @@ class IndexQueryTestCase(ModuleStoreTestCase):
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@pytest.mark.django111_expected_failure
class ViewsTestCase(ModuleStoreTestCase): class ViewsTestCase(ModuleStoreTestCase):
""" """
Tests for views.py methods. Tests for views.py methods.
......
...@@ -6,6 +6,7 @@ import mock ...@@ -6,6 +6,7 @@ import mock
from contextlib import contextmanager from contextlib import contextmanager
import ddt import ddt
import pytest
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.management import call_command from django.core.management import call_command
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -75,6 +76,7 @@ class MockRequestSetupMixin(object): ...@@ -75,6 +76,7 @@ class MockRequestSetupMixin(object):
@attr(shard=2) @attr(shard=2)
@patch('lms.lib.comment_client.utils.requests.request', autospec=True) @patch('lms.lib.comment_client.utils.requests.request', autospec=True)
@pytest.mark.django111_expected_failure
class CreateThreadGroupIdTestCase( class CreateThreadGroupIdTestCase(
MockRequestSetupMixin, MockRequestSetupMixin,
CohortedTestCase, CohortedTestCase,
...@@ -495,6 +497,7 @@ class ViewsTestCase( ...@@ -495,6 +497,7 @@ class ViewsTestCase(
with self.assert_discussion_signals('thread_created'): with self.assert_discussion_signals('thread_created'):
self.create_thread_helper(mock_request) self.create_thread_helper(mock_request)
@pytest.mark.django111_expected_failure
def test_create_thread_standalone(self, mock_request): def test_create_thread_standalone(self, mock_request):
team = CourseTeamFactory.create( team = CourseTeamFactory.create(
name="A Team", name="A Team",
...@@ -1408,6 +1411,7 @@ class CreateSubCommentUnicodeTestCase( ...@@ -1408,6 +1411,7 @@ class CreateSubCommentUnicodeTestCase(
@disable_signal(views, 'comment_created') @disable_signal(views, 'comment_created')
@disable_signal(views, 'comment_voted') @disable_signal(views, 'comment_voted')
@disable_signal(views, 'comment_deleted') @disable_signal(views, 'comment_deleted')
@pytest.mark.django111_expected_failure
class TeamsPermissionsTestCase(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase, MockRequestSetupMixin): class TeamsPermissionsTestCase(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase, MockRequestSetupMixin):
# Most of the test points use the same ddt data. # Most of the test points use the same ddt data.
# args: user, commentable_id, status_code # args: user, commentable_id, status_code
...@@ -1874,6 +1878,7 @@ class ForumEventTestCase(ForumsEnableMixin, SharedModuleStoreTestCase, MockReque ...@@ -1874,6 +1878,7 @@ class ForumEventTestCase(ForumsEnableMixin, SharedModuleStoreTestCase, MockReque
{'comment_id': 'dummy_comment_id'} {'comment_id': 'dummy_comment_id'}
)) ))
@ddt.unpack @ddt.unpack
@pytest.mark.django111_expected_failure
def test_team_events(self, view_name, event_name, view_data, view_kwargs, mock_request, mock_emit): def test_team_events(self, view_name, event_name, view_data, view_kwargs, mock_request, mock_emit):
user = self.student user = self.student
team = CourseTeamFactory.create(discussion_topic_id=TEAM_COMMENTABLE_ID) team = CourseTeamFactory.create(discussion_topic_id=TEAM_COMMENTABLE_ID)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Tests for bookmarks api. Tests for bookmarks api.
""" """
import ddt import ddt
import pytest
from mock import patch from mock import patch
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
...@@ -39,6 +40,7 @@ class BookmarkApiEventTestMixin(object): ...@@ -39,6 +40,7 @@ class BookmarkApiEventTestMixin(object):
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@skip_unless_lms @skip_unless_lms
@pytest.mark.django111_expected_failure
class BookmarksAPITests(BookmarkApiEventTestMixin, BookmarksTestsBase): class BookmarksAPITests(BookmarkApiEventTestMixin, BookmarksTestsBase):
""" """
These tests cover the parts of the API methods. These tests cover the parts of the API methods.
......
""" """
Tests for Bookmarks models. Tests for Bookmarks models.
""" """
from contextlib import contextmanager
import datetime import datetime
from contextlib import contextmanager
import ddt import ddt
from freezegun import freeze_time
import mock import mock
from nose.plugins.attrib import attr import pytest
import pytz import pytz
from freezegun import freeze_time
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import UsageKey from opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.locator import CourseLocator, BlockUsageLocator from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import check_mongo_calls, CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from openedx.core.djangolib.testing.utils import skip_unless_lms from openedx.core.djangolib.testing.utils import skip_unless_lms
from student.tests.factories import AdminFactory, UserFactory from student.tests.factories import AdminFactory, UserFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
from .. import DEFAULT_FIELDS, OPTIONAL_FIELDS, PathItem from .. import DEFAULT_FIELDS, OPTIONAL_FIELDS, PathItem
from ..models import Bookmark, XBlockCache, parse_path_data from ..models import Bookmark, XBlockCache, parse_path_data
...@@ -264,6 +265,7 @@ class BookmarkModelTests(BookmarksTestsBase): ...@@ -264,6 +265,7 @@ class BookmarkModelTests(BookmarksTestsBase):
(ModuleStoreEnum.Type.split, 'html_1', ['chapter_1', 'sequential_2', 'vertical_2'], 2), (ModuleStoreEnum.Type.split, 'html_1', ['chapter_1', 'sequential_2', 'vertical_2'], 2),
) )
@ddt.unpack @ddt.unpack
@pytest.mark.django111_expected_failure
def test_path_and_queries_on_create(self, store_type, block_to_bookmark, ancestors_attrs, expected_mongo_calls): def test_path_and_queries_on_create(self, store_type, block_to_bookmark, ancestors_attrs, expected_mongo_calls):
""" """
In case of mongo, 1 query is used to fetch the block, and 2 In case of mongo, 1 query is used to fetch the block, and 2
...@@ -287,6 +289,7 @@ class BookmarkModelTests(BookmarksTestsBase): ...@@ -287,6 +289,7 @@ class BookmarkModelTests(BookmarksTestsBase):
self.assertIsNotNone(bookmark.xblock_cache) self.assertIsNotNone(bookmark.xblock_cache)
self.assertEqual(bookmark.xblock_cache.paths, []) self.assertEqual(bookmark.xblock_cache.paths, [])
@pytest.mark.django111_expected_failure
def test_create_bookmark_success(self): def test_create_bookmark_success(self):
""" """
Tests creation of bookmark. Tests creation of bookmark.
...@@ -309,6 +312,7 @@ class BookmarkModelTests(BookmarksTestsBase): ...@@ -309,6 +312,7 @@ class BookmarkModelTests(BookmarksTestsBase):
self.assertNotEqual(bookmark, bookmark3) self.assertNotEqual(bookmark, bookmark3)
self.assert_bookmark_model_is_valid(bookmark3, bookmark_data_different_user) self.assert_bookmark_model_is_valid(bookmark3, bookmark_data_different_user)
@pytest.mark.django111_expected_failure
def test_create_bookmark_successfully_with_display_name_none(self): def test_create_bookmark_successfully_with_display_name_none(self):
""" """
Tests creation of bookmark with display_name None. Tests creation of bookmark with display_name None.
...@@ -327,6 +331,7 @@ class BookmarkModelTests(BookmarksTestsBase): ...@@ -327,6 +331,7 @@ class BookmarkModelTests(BookmarksTestsBase):
) )
@ddt.unpack @ddt.unpack
@mock.patch('openedx.core.djangoapps.bookmarks.models.Bookmark.get_path') @mock.patch('openedx.core.djangoapps.bookmarks.models.Bookmark.get_path')
@pytest.mark.django111_expected_failure
def test_path(self, seconds_delta, paths, get_path_call_count, mock_get_path): def test_path(self, seconds_delta, paths, get_path_call_count, mock_get_path):
block_path = [PathItem(UsageKey.from_string(EXAMPLE_USAGE_KEY_1), '1')] block_path = [PathItem(UsageKey.from_string(EXAMPLE_USAGE_KEY_1), '1')]
...@@ -364,6 +369,7 @@ class BookmarkModelTests(BookmarksTestsBase): ...@@ -364,6 +369,7 @@ class BookmarkModelTests(BookmarksTestsBase):
(ModuleStoreEnum.Type.split, 2, 4, 2), (ModuleStoreEnum.Type.split, 2, 4, 2),
) )
@ddt.unpack @ddt.unpack
@pytest.mark.django111_expected_failure
def test_get_path_queries(self, store_type, children_per_block, depth, expected_mongo_calls): def test_get_path_queries(self, store_type, children_per_block, depth, expected_mongo_calls):
""" """
In case of mongo, 2 queries are used by path_to_location(), and then In case of mongo, 2 queries are used by path_to_location(), and then
...@@ -382,6 +388,7 @@ class BookmarkModelTests(BookmarksTestsBase): ...@@ -382,6 +388,7 @@ class BookmarkModelTests(BookmarksTestsBase):
path = Bookmark.get_path(block.location) path = Bookmark.get_path(block.location)
self.assertEqual(len(path), depth - 2) self.assertEqual(len(path), depth - 2)
@pytest.mark.django111_expected_failure
def test_get_path_in_case_of_exceptions(self): def test_get_path_in_case_of_exceptions(self):
user = UserFactory.create() user = UserFactory.create()
......
""" """
Tests for bookmark services. Tests for bookmark services.
""" """
from nose.plugins.attrib import attr
import pytest
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import UsageKey from opaque_keys.edx.keys import UsageKey
from openedx.core.djangolib.testing.utils import skip_unless_lms from openedx.core.djangolib.testing.utils import skip_unless_lms
...@@ -12,6 +13,7 @@ from .test_models import BookmarksTestsBase ...@@ -12,6 +13,7 @@ from .test_models import BookmarksTestsBase
@attr(shard=2) @attr(shard=2)
@skip_unless_lms @skip_unless_lms
@pytest.mark.django111_expected_failure
class BookmarksServiceTests(BookmarksTestsBase): class BookmarksServiceTests(BookmarksTestsBase):
""" """
Tests the Bookmarks service. Tests the Bookmarks service.
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
Tests for tasks. Tests for tasks.
""" """
import ddt import ddt
import pytest
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import check_mongo_calls, ItemFactory from xmodule.modulestore.tests.factories import check_mongo_calls, ItemFactory
from ..models import XBlockCache from ..models import XBlockCache
from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache
from .test_models import BookmarksTestsBase from .test_models import BookmarksTestsBase
...@@ -14,6 +14,7 @@ from .test_models import BookmarksTestsBase ...@@ -14,6 +14,7 @@ from .test_models import BookmarksTestsBase
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@pytest.mark.django111_expected_failure
class XBlockCacheTaskTests(BookmarksTestsBase): class XBlockCacheTaskTests(BookmarksTestsBase):
""" """
Test the XBlockCache model. Test the XBlockCache model.
......
""" """
Tests for bookmark views. Tests for bookmark views.
""" """
import ddt
import json import json
from nose.plugins.attrib import attr
import urllib import urllib
import ddt
import pytest
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from mock import patch from mock import patch
from nose.plugins.attrib import attr
from rest_framework.test import APIClient from rest_framework.test import APIClient
from openedx.core.djangolib.testing.utils import skip_unless_lms from openedx.core.djangolib.testing.utils import skip_unless_lms
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from .test_models import BookmarksTestsBase
from .test_api import BookmarkApiEventTestMixin from .test_api import BookmarkApiEventTestMixin
from .test_models import BookmarksTestsBase
# pylint: disable=no-member # pylint: disable=no-member
...@@ -67,6 +66,7 @@ class BookmarksViewsTestsBase(BookmarksTestsBase, BookmarkApiEventTestMixin): ...@@ -67,6 +66,7 @@ class BookmarksViewsTestsBase(BookmarksTestsBase, BookmarkApiEventTestMixin):
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@skip_unless_lms @skip_unless_lms
@pytest.mark.django111_expected_failure
class BookmarksListViewTests(BookmarksViewsTestsBase): class BookmarksListViewTests(BookmarksViewsTestsBase):
""" """
This contains the tests for GET & POST methods of bookmark.views.BookmarksListView class This contains the tests for GET & POST methods of bookmark.views.BookmarksListView class
...@@ -372,6 +372,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase): ...@@ -372,6 +372,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@skip_unless_lms @skip_unless_lms
@pytest.mark.django111_expected_failure
class BookmarksDetailViewTests(BookmarksViewsTestsBase): class BookmarksDetailViewTests(BookmarksViewsTestsBase):
""" """
This contains the tests for GET & DELETE methods of bookmark.views.BookmarksDetailView class This contains the tests for GET & DELETE methods of bookmark.views.BookmarksDetailView class
......
...@@ -5,44 +5,45 @@ import datetime ...@@ -5,44 +5,45 @@ import datetime
import json import json
import ddt import ddt
import httpretty
import mock
import pytest
import pytz
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core import mail from django.core import mail
from django.test.utils import override_settings
from django.db import connection from django.db import connection
from django.test.utils import override_settings
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
import httpretty
from lms.djangoapps.commerce.tests import TEST_API_URL
import mock
import pytz
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from course_modes.models import CourseMode
from lms.djangoapps.commerce.tests import TEST_API_URL
from openedx.core.djangoapps.credit import api from openedx.core.djangoapps.credit import api
from openedx.core.djangoapps.credit.email_utils import get_credit_provider_display_names, make_providers_strings from openedx.core.djangoapps.credit.email_utils import get_credit_provider_display_names, make_providers_strings
from openedx.core.djangoapps.credit.exceptions import ( from openedx.core.djangoapps.credit.exceptions import (
InvalidCreditRequirements, CreditRequestNotFound,
InvalidCreditCourse, InvalidCreditCourse,
RequestAlreadyCompleted, InvalidCreditRequirements,
UserIsNotEligible,
InvalidCreditStatus, InvalidCreditStatus,
CreditRequestNotFound, RequestAlreadyCompleted,
UserIsNotEligible
) )
from openedx.core.djangoapps.credit.models import ( from openedx.core.djangoapps.credit.models import (
CreditConfig, CreditConfig,
CreditCourse, CreditCourse,
CreditEligibility,
CreditProvider, CreditProvider,
CreditRequest,
CreditRequirement, CreditRequirement,
CreditRequirementStatus, CreditRequirementStatus
CreditEligibility,
CreditRequest
) )
from openedx.core.djangolib.testing.utils import skip_unless_lms from openedx.core.djangolib.testing.utils import skip_unless_lms
from course_modes.models import CourseMode
from student.models import CourseEnrollment from student.models import CourseEnrollment
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from util.date_utils import from_timestamp from util.date_utils import from_timestamp
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
TEST_CREDIT_PROVIDER_SECRET_KEY = "931433d583c84ca7ba41784bad3232e6" TEST_CREDIT_PROVIDER_SECRET_KEY = "931433d583c84ca7ba41784bad3232e6"
TEST_ECOMMERCE_WORKER = 'test_worker' TEST_ECOMMERCE_WORKER = 'test_worker'
...@@ -205,6 +206,7 @@ class CreditApiTestBase(ModuleStoreTestCase): ...@@ -205,6 +206,7 @@ class CreditApiTestBase(ModuleStoreTestCase):
@attr(shard=2) @attr(shard=2)
@skip_unless_lms @skip_unless_lms
@ddt.ddt @ddt.ddt
@pytest.mark.django111_expected_failure
class CreditRequirementApiTests(CreditApiTestBase): class CreditRequirementApiTests(CreditApiTestBase):
""" """
Test Python API for credit requirements and eligibility. Test Python API for credit requirements and eligibility.
......
...@@ -6,11 +6,12 @@ import uuid ...@@ -6,11 +6,12 @@ import uuid
import ddt import ddt
import httpretty import httpretty
import mock
import pytest
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
import mock
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from pytz import utc from pytz import utc
...@@ -20,28 +21,27 @@ from lms.djangoapps.commerce.tests.test_utils import update_commerce_config ...@@ -20,28 +21,27 @@ from lms.djangoapps.commerce.tests.test_utils import update_commerce_config
from lms.djangoapps.commerce.utils import EcommerceService from lms.djangoapps.commerce.utils import EcommerceService
from lms.djangoapps.grades.tests.utils import mock_passing_grade from lms.djangoapps.grades.tests.utils import mock_passing_grade
from openedx.core.djangoapps.catalog.tests.factories import ( from openedx.core.djangoapps.catalog.tests.factories import (
generate_course_run_key,
ProgramFactory,
CourseFactory, CourseFactory,
CourseRunFactory, CourseRunFactory,
ProgramFactory,
SeatFactory, SeatFactory,
generate_course_run_key
) )
from openedx.core.djangoapps.programs.tests.factories import ProgressFactory from openedx.core.djangoapps.programs.tests.factories import ProgressFactory
from openedx.core.djangoapps.programs.utils import ( from openedx.core.djangoapps.programs.utils import (
DEFAULT_ENROLLMENT_START_DATE, DEFAULT_ENROLLMENT_START_DATE,
ProgramProgressMeter,
ProgramDataExtender, ProgramDataExtender,
ProgramMarketingDataExtender, ProgramMarketingDataExtender,
get_certificates, ProgramProgressMeter,
get_certificates
) )
from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory
from openedx.core.djangolib.testing.utils import skip_unless_lms from openedx.core.djangolib.testing.utils import skip_unless_lms
from student.tests.factories import AnonymousUserFactory, UserFactory, CourseEnrollmentFactory from student.tests.factories import AnonymousUserFactory, CourseEnrollmentFactory, UserFactory
from util.date_utils import strftime_localized from util.date_utils import strftime_localized
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory as ModuleStoreCourseFactory from xmodule.modulestore.tests.factories import CourseFactory as ModuleStoreCourseFactory
CERTIFICATES_API_MODULE = 'lms.djangoapps.certificates.api' CERTIFICATES_API_MODULE = 'lms.djangoapps.certificates.api'
ECOMMERCE_URL_ROOT = 'https://ecommerce.example.com' ECOMMERCE_URL_ROOT = 'https://ecommerce.example.com'
UTILS_MODULE = 'openedx.core.djangoapps.programs.utils' UTILS_MODULE = 'openedx.core.djangoapps.programs.utils'
...@@ -51,6 +51,7 @@ UTILS_MODULE = 'openedx.core.djangoapps.programs.utils' ...@@ -51,6 +51,7 @@ UTILS_MODULE = 'openedx.core.djangoapps.programs.utils'
@attr(shard=2) @attr(shard=2)
@skip_unless_lms @skip_unless_lms
@mock.patch(UTILS_MODULE + '.get_programs') @mock.patch(UTILS_MODULE + '.get_programs')
@pytest.mark.django111_expected_failure
class TestProgramProgressMeter(TestCase): class TestProgramProgressMeter(TestCase):
"""Tests of the program progress utility class.""" """Tests of the program progress utility class."""
def setUp(self): def setUp(self):
......
...@@ -6,6 +6,7 @@ Most of the functionality is covered in test_views.py. ...@@ -6,6 +6,7 @@ Most of the functionality is covered in test_views.py.
import re import re
import ddt
import pytest import pytest
from dateutil.parser import parse as parse_datetime from dateutil.parser import parse as parse_datetime
from django.conf import settings from django.conf import settings
...@@ -14,11 +15,10 @@ from django.core import mail ...@@ -14,11 +15,10 @@ from django.core import mail
from django.test import TestCase from django.test import TestCase
from django.test.client import RequestFactory from django.test.client import RequestFactory
from mock import Mock, patch from mock import Mock, patch
from six import iteritems
import ddt
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from nose.tools import raises from nose.tools import raises
from six import iteritems
from openedx.core.djangoapps.user_api.accounts import PRIVATE_VISIBILITY, USERNAME_MAX_LENGTH from openedx.core.djangoapps.user_api.accounts import PRIVATE_VISIBILITY, USERNAME_MAX_LENGTH
from openedx.core.djangoapps.user_api.accounts.api import ( from openedx.core.djangoapps.user_api.accounts.api import (
activate_account, activate_account,
...@@ -409,6 +409,7 @@ class AccountCreationActivationAndPasswordChangeTest(TestCase): ...@@ -409,6 +409,7 @@ class AccountCreationActivationAndPasswordChangeTest(TestCase):
activate_account(u'invalid') activate_account(u'invalid')
@skip_unless_lms @skip_unless_lms
@pytest.mark.django111_expected_failure
def test_request_password_change(self): def test_request_password_change(self):
# Create and activate an account # Create and activate an account
activation_key = create_account(self.USERNAME, self.PASSWORD, self.EMAIL) activation_key = create_account(self.USERNAME, self.PASSWORD, self.EMAIL)
...@@ -427,6 +428,7 @@ class AccountCreationActivationAndPasswordChangeTest(TestCase): ...@@ -427,6 +428,7 @@ class AccountCreationActivationAndPasswordChangeTest(TestCase):
self.assertIsNot(result, None) self.assertIsNot(result, None)
@skip_unless_lms @skip_unless_lms
@pytest.mark.django111_expected_failure
def test_request_password_change_invalid_user(self): def test_request_password_change_invalid_user(self):
with self.assertRaises(UserNotFound): with self.assertRaises(UserNotFound):
request_password_change(self.EMAIL, self.IS_SECURE) request_password_change(self.EMAIL, self.IS_SECURE)
......
...@@ -3,36 +3,40 @@ ...@@ -3,36 +3,40 @@
Test cases to cover Accounts-related behaviors of the User API application Test cases to cover Accounts-related behaviors of the User API application
""" """
import datetime import datetime
import ddt
import hashlib import hashlib
import json import json
import unittest import unittest
from copy import deepcopy from copy import deepcopy
from mock import patch
from nose.plugins.attrib import attr
from pytz import UTC
import ddt
import pytest
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import TestCase from django.test import TestCase
from django.test.testcases import TransactionTestCase from django.test.testcases import TransactionTestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from pytz import UTC
from rest_framework import status from rest_framework import status
from rest_framework.test import APITestCase, APIClient from rest_framework.test import APIClient, APITestCase
from .. import PRIVATE_VISIBILITY, ALL_USERS_VISIBILITY
from openedx.core.djangoapps.user_api.accounts import ACCOUNT_VISIBILITY_PREF_KEY from openedx.core.djangoapps.user_api.accounts import ACCOUNT_VISIBILITY_PREF_KEY
from openedx.core.djangoapps.user_api.models import UserPreference from openedx.core.djangoapps.user_api.models import UserPreference
from openedx.core.djangoapps.user_api.preferences.api import set_user_preference from openedx.core.djangoapps.user_api.preferences.api import set_user_preference
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
from openedx.core.lib.token_utils import JwtBuilder from openedx.core.lib.token_utils import JwtBuilder
from student.models import UserProfile, LanguageProficiency, PendingEmailChange from student.models import LanguageProficiency, PendingEmailChange, UserProfile
from student.tests.factories import ( from student.tests.factories import (
ContentTypeFactory, TEST_PASSWORD, PermissionFactory, SuperuserFactory, UserFactory TEST_PASSWORD,
ContentTypeFactory,
PermissionFactory,
SuperuserFactory,
UserFactory
) )
from .. import ALL_USERS_VISIBILITY, PRIVATE_VISIBILITY
TEST_PROFILE_IMAGE_UPLOADED_AT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC) TEST_PROFILE_IMAGE_UPLOADED_AT = datetime.datetime(2002, 1, 9, 15, 43, 1, tzinfo=UTC)
# this is used in one test to check the behavior of profile image url # this is used in one test to check the behavior of profile image url
...@@ -297,6 +301,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase): ...@@ -297,6 +301,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
# This is needed when testing CMS as the patching is still executed even though the # This is needed when testing CMS as the patching is still executed even though the
# suite is skipped. # suite is skipped.
@patch.dict(getattr(settings, "ACCOUNT_VISIBILITY_CONFIGURATION", {}), {"default_visibility": "all_users"}) @patch.dict(getattr(settings, "ACCOUNT_VISIBILITY_CONFIGURATION", {}), {"default_visibility": "all_users"})
@pytest.mark.django111_expected_failure
def test_get_account_different_user_visible(self): def test_get_account_different_user_visible(self):
""" """
Test that a client (logged in) can only get the shareable fields for a different user. Test that a client (logged in) can only get the shareable fields for a different user.
...@@ -312,6 +317,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase): ...@@ -312,6 +317,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
# This is needed when testing CMS as the patching is still executed even though the # This is needed when testing CMS as the patching is still executed even though the
# suite is skipped. # suite is skipped.
@patch.dict(getattr(settings, "ACCOUNT_VISIBILITY_CONFIGURATION", {}), {"default_visibility": "private"}) @patch.dict(getattr(settings, "ACCOUNT_VISIBILITY_CONFIGURATION", {}), {"default_visibility": "private"})
@pytest.mark.django111_expected_failure
def test_get_account_different_user_private(self): def test_get_account_different_user_private(self):
""" """
Test that a client (logged in) can only get the shareable fields for a different user. Test that a client (logged in) can only get the shareable fields for a different user.
...@@ -333,6 +339,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase): ...@@ -333,6 +339,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
("staff_client", "staff_user", ALL_USERS_VISIBILITY), ("staff_client", "staff_user", ALL_USERS_VISIBILITY),
) )
@ddt.unpack @ddt.unpack
@pytest.mark.django111_expected_failure
def test_get_account_private_visibility(self, api_client, requesting_username, preference_visibility): def test_get_account_private_visibility(self, api_client, requesting_username, preference_visibility):
""" """
Test the return from GET based on user visibility setting. Test the return from GET based on user visibility setting.
...@@ -611,6 +618,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase): ...@@ -611,6 +618,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
{'full': 50, 'medium': 30, 'small': 10}, {'full': 50, 'medium': 30, 'small': 10},
clear=True clear=True
) )
@pytest.mark.django111_expected_failure
def test_patch_email(self): def test_patch_email(self):
""" """
Test that the user can request an email change through the accounts API. Test that the user can request an email change through the accounts API.
......
...@@ -7,29 +7,30 @@ from __future__ import unicode_literals ...@@ -7,29 +7,30 @@ from __future__ import unicode_literals
import itertools import itertools
import json import json
import unittest
from collections import namedtuple from collections import namedtuple
from datetime import datetime, timedelta
import ddt import ddt
from datetime import datetime, timedelta import pytest
from django.conf import settings from django.conf import settings
from django.conf.urls import url, include from django.conf.urls import include, url
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase from django.test import TestCase
from django.utils.http import urlencode from django.utils.http import urlencode
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from oauth2_provider import models as dot_models from oauth2_provider import models as dot_models
from provider import constants, scope
from rest_framework import status from rest_framework import status
from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import IsAuthenticated
from rest_framework.test import APIRequestFactory, APIClient from rest_framework.test import APIClient, APIRequestFactory
from rest_framework.views import APIView from rest_framework.views import APIView
from rest_framework_oauth import permissions from rest_framework_oauth import permissions
from rest_framework_oauth.compat import oauth2_provider, oauth2_provider_scope from rest_framework_oauth.compat import oauth2_provider, oauth2_provider_scope
import unittest
from openedx.core.djangoapps.oauth_dispatch import adapters from openedx.core.djangoapps.oauth_dispatch import adapters
from openedx.core.lib.api import authentication from openedx.core.lib.api import authentication
from provider import constants, scope
factory = APIRequestFactory() # pylint: disable=invalid-name factory = APIRequestFactory() # pylint: disable=invalid-name
...@@ -74,6 +75,7 @@ urlpatterns = [ ...@@ -74,6 +75,7 @@ urlpatterns = [
@attr(shard=2) @attr(shard=2)
@ddt.ddt @ddt.ddt
@unittest.skipUnless(settings.FEATURES.get("ENABLE_OAUTH2_PROVIDER"), "OAuth2 not enabled") @unittest.skipUnless(settings.FEATURES.get("ENABLE_OAUTH2_PROVIDER"), "OAuth2 not enabled")
@pytest.mark.django111_expected_failure
class OAuth2Tests(TestCase): class OAuth2Tests(TestCase):
"""OAuth 2.0 authentication""" """OAuth 2.0 authentication"""
urls = 'openedx.core.lib.api.tests.test_authentication' urls = 'openedx.core.lib.api.tests.test_authentication'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment