Commit d5e0df30 by Vedran Karacic

Change the range catalog query to be a textfield.

The catalog query field needs to be able to store more than 255 characters,
therefor it's being changed to a Django TextField field.

https://openedx.atlassian.net/browse/SOL-2101
parent df4ad118
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('offer', '0006_auto_20161025_1446'),
]
operations = [
migrations.AlterField(
model_name='range',
name='catalog_query',
field=models.TextField(null=True, blank=True),
),
]
......@@ -75,7 +75,7 @@ class Range(AbstractRange):
'course_seat_types',
]
catalog = models.ForeignKey('catalogue.Catalog', blank=True, null=True, related_name='ranges')
catalog_query = models.CharField(max_length=255, blank=True, null=True)
catalog_query = models.TextField(blank=True, null=True)
course_seat_types = models.CharField(
max_length=255,
validators=[validate_credit_seat_type],
......
......@@ -61,6 +61,20 @@ class RangeTests(CouponMixin, CourseCatalogTestMixin, CourseCatalogMockMixin, Te
self.assertIn(self.product, self.range_with_catalog.all_products())
self.assertEqual(len(self.range_with_catalog.all_products()), 1)
def test_large_query(self):
"""Verify the range can store large queries."""
large_query = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
"""
self.range.catalog_query = large_query
self.range.save()
self.assertEqual(self.range.catalog_query, large_query)
@mock.patch('ecommerce.core.url_utils.get_current_request', mock.Mock(return_value=None))
def test_run_catalog_query_no_request(self):
"""
......
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