Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

4 participants

@vaidik

https://bugzilla.mozilla.org/show_bug.cgi?id=725643

Collection description is not allowed to be more than 200 chars. On entering a description longer than 200, the form doesn't work and doesn't show an error as well.

@vaidik

Forgot that one. Fixed! Please review.

@vaidik vaidik Add to collection -> Start a new collection on addon pages shows erro…
…r when description is longer than 200 chars (bug 725643)
54ecab1
@vaidik

Got most of the unwanted things from another existing test which I used to write this test. I have fixed the indentation in the other test as well. Please review.

@cvan

this could form.description.errors too. either way works.

@cvan

a better test would be to check 201 - because we don't know what happens for anything between 200 and 250.

@mattbasta mattbasta commented on the diff
apps/bandwagon/tests/test_views.py
((16 lines not shown))
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 '

weird indentation right there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@andymckay
Owner

is this good to merge?

@mattbasta

Vaidik: If you rebase and fix any merge conflicts, I'll merge. Thanks!

@cvan
Owner

can we merge this?

@cvan cvan closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 3, 2012
  1. @vaidik

    Add to collection -> Start a new collection on addon pages shows erro…

    vaidik authored
    …r when description is longer than 200 chars (bug 725643)
This page is out of date. Refresh to see the latest.
View
3  apps/bandwagon/templates/bandwagon/ajax_new.html
@@ -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>
View
24 apps/bandwagon/tests/test_views.py
@@ -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 '

weird indentation right there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ '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)
Something went wrong with that request. Please try again.