Commit 10ef6f5c by Albert St. Aubin Committed by Harry Rein

Adds one more test for Entitlement enrollment.

parent 828ca183
...@@ -5,6 +5,7 @@ import datetime ...@@ -5,6 +5,7 @@ import datetime
import itertools import itertools
import json import json
import unittest import unittest
import uuid
import ddt import ddt
import httpretty import httpretty
...@@ -210,6 +211,21 @@ class EntitlementEnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITes ...@@ -210,6 +211,21 @@ class EntitlementEnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITes
entitlement.refresh_from_db() entitlement.refresh_from_db()
self.assertIsNone(entitlement.enrollment_course_run) self.assertIsNone(entitlement.enrollment_course_run)
def test_enroll_no_entitlement(self):
resp = self.assert_enrollment_status(
course_id=unicode(self.course.id),
course_uuid=str(uuid.uuid4()),
is_active=True,
mode=None,
max_mongo_calls=4,
expected_status=status.HTTP_400_BAD_REQUEST
)
data = json.loads(resp.content)
self.assertEqual(self.course.display_name_with_default, data['course_details']['course_name'])
# Verify that the enrollment was created correctly
self.assertFalse(CourseEnrollment.is_enrolled(self.user, self.course.id))
@attr(shard=3) @attr(shard=3)
@override_settings(EDX_API_KEY="i am a key") @override_settings(EDX_API_KEY="i am a key")
......
...@@ -223,7 +223,6 @@ class CourseEntitlement(TimeStampedModel): ...@@ -223,7 +223,6 @@ class CourseEntitlement(TimeStampedModel):
entitlement = cls.objects.get( entitlement = cls.objects.get(
user=user, user=user,
course_uuid=course_uuid, course_uuid=course_uuid,
expired_at=None,
) )
return entitlement return entitlement
except cls.DoesNotExist: except cls.DoesNotExist:
......
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