Add to collection -> Start a new collection on addon pages shows error when description is longer than 200 chars (bug 725643) #288

Closed
wants to merge 1 commit into
from
@@ -6,7 +6,7 @@
{{ field(form.name, _('Name:')) }}
{% set slug_base = url('collections.user', user.get_profile().username, add_prefix=False) %}
<p id="collection-form-slug">
- {{ form.errors['slug'] }}
+ {{ form.errors.slug }}
<label>{{ form.slug.label }}</label>
<span id="slug_edit" class="edit_with_prefix edit_initially_hidden">
<span>{{ slug_base }}</span>{{ form.slug }}
@@ -17,6 +17,7 @@
</span>
</p>
<p>
+ {{ form.errors.description }}
<label for="id_description">{{ form.description.label }}</label> {{ _('(optional)') }}
{{ form.description }}
</p>
@@ -755,16 +755,28 @@ def test_remove_collection(self):
def test_new_collection(self):
num_collections = Collection.objects.all().count()
r = self.client.post(reverse('collections.ajax_new'),
- {'addon_id': 5299,
- 'name': 'foo',
- 'slug': 'auniqueone',
- 'description': 'yermom',
- 'listed': True},
- follow=True)
+ {'addon_id': 5299,
+ 'name': 'foo',
+ 'slug': 'auniqueone',
+ 'description': 'yermom',
+ 'listed': True},
+ follow=True)
doc = pq(r.content)
eq_(len(doc('li.selected')), 1, "The new collection is not selected.")
eq_(Collection.objects.all().count(), num_collections + 1)
+ def test_new_collection_long_description(self):
+ r = self.client.post(reverse('collections.ajax_new'),
+ {'addon_id': 5299,
+ 'name': 'foo',
+ 'slug': 'auniqueone',
+ 'description': '1'*250,
+ 'listed': True},
+ follow=True)
+ self.assertFormError(r, 'form', 'description',
+ 'Ensure this value has at '
@mattbasta

mattbasta Dec 29, 2012

Contributor

weird indentation right there

+ 'most 200 characters (it has 250).')
+
def test_add_other_collection(self):
"403 when you try to add to a collection that isn't yours."
c = Collection(author=self.other)