~sirn/fanboi2

6713af3bca6247f57cb9b84ed0856713c56067d8 — Kridsada Thanabulpong 6 years ago 5b1619e
Raise minimum body character requirement to 5 characters.
M fanboi2/forms.py => fanboi2/forms.py +2 -2
@@ 77,7 77,7 @@ class TopicForm(Form):
    :class:`Post`.
    """
    title = TextField('Title', validators=[Required(), Length(5, 200)])
    body = TextAreaField('Body', validators=[Required(), Length(2, 4000)])
    body = TextAreaField('Body', validators=[Required(), Length(5, 4000)])


class SecureTopicForm(SecureForm, TopicForm, Form):


@@ 88,7 88,7 @@ class PostForm(Form):
    """A :class:`Form` for replying to a topic. The :attr:`body` field should
    be populated to :class:`Post`.
    """
    body = TextAreaField('Body', validators=[Required(), Length(2, 4000)])
    body = TextAreaField('Body', validators=[Required(), Length(5, 4000)])
    bumped = BooleanField('Bump this topic', default=True)



M fanboi2/templates/api/_posts.mako => fanboi2/templates/api/_posts.mako +1 -1
@@ 18,7 18,7 @@
                        <tr class="api-table-row">
                            <th class="api-table-item title">body</th>
                            <td class="api-table-item type">String</td>
                            <td class="api-table-item">Content of the topic. From 2 to 4,000 characters.</td>
                            <td class="api-table-item">Content of the topic. From 5 to 4,000 characters.</td>
                        </tr>
                        <tr class="api-table-row">
                            <th class="api-table-item title">bumped</th>

M fanboi2/templates/api/_topics.mako => fanboi2/templates/api/_topics.mako +1 -1
@@ 23,7 23,7 @@
                        <tr class="api-table-row">
                            <th class="api-table-item title">body</th>
                            <th class="api-table-item type">String</th>
                            <td class="api-table-item">Content of the topic. From 2 to 4,000 characters.</td>
                            <td class="api-table-item">Content of the topic. From 5 to 4,000 characters.</td>
                        </tr>
                    </tbody>
                </table>

M fanboi2/templates/api/show.mako => fanboi2/templates/api/show.mako +1 -1
@@ 3,7 3,7 @@
<header class="subheader">
    <div class="container">
        <h2 class="subheader-title">API documentation</h2>
        <div class="subheader-body"><p>Last updated <strong>Sep 29, 2015</strong></p></div>
        <div class="subheader-body"><p>Last updated <strong>Feb 12, 2017</strong></p></div>
    </div>
</header>
<%include file='_boards.mako' />

M fanboi2/tests/test_forms.py => fanboi2/tests/test_forms.py +7 -7
@@ 160,7 160,7 @@ class TestTopicForm(FormMixin, unittest.TestCase):

    def test_title_length_shorter(self):
        request = self._makeRequest()
        form = self._makeOne({'title': 'Foob'}, request=request)
        form = self._makeOne({'title': 'F'*4}, request=request)
        self.assertFalse(form.validate())
        self.assertListEqual(form.title.errors, [
            'Field must be between 5 and 200 characters long.'


@@ 182,10 182,10 @@ class TestTopicForm(FormMixin, unittest.TestCase):

    def test_body_length_shorter(self):
        request = self._makeRequest()
        form = self._makeOne({'body': 'F'}, request=request)
        form = self._makeOne({'body': 'F'*4}, request=request)
        self.assertFalse(form.validate())
        self.assertListEqual(form.body.errors, [
            'Field must be between 2 and 4000 characters long.'
            'Field must be between 5 and 4000 characters long.'
        ])

    def test_body_length_longer(self):


@@ 193,7 193,7 @@ class TestTopicForm(FormMixin, unittest.TestCase):
        form = self._makeOne({'body': 'F'*4001}, request=request)
        self.assertFalse(form.validate())
        self.assertListEqual(form.body.errors, [
            'Field must be between 2 and 4000 characters long.'
            'Field must be between 5 and 4000 characters long.'
        ])




@@ 239,10 239,10 @@ class TestPostForm(FormMixin, unittest.TestCase):

    def test_body_length_shorter(self):
        request = self._makeRequest()
        form = self._makeOne({'body': 'F'}, request=request)
        form = self._makeOne({'body': 'F'*4}, request=request)
        self.assertFalse(form.validate())
        self.assertListEqual(form.body.errors, [
            'Field must be between 2 and 4000 characters long.'
            'Field must be between 5 and 4000 characters long.'
        ])

    def test_body_length_longer(self):


@@ 250,7 250,7 @@ class TestPostForm(FormMixin, unittest.TestCase):
        form = self._makeOne({'body': 'F'*4001}, request=request)
        self.assertFalse(form.validate())
        self.assertListEqual(form.body.errors, [
            'Field must be between 2 and 4000 characters long.'
            'Field must be between 5 and 4000 characters long.'
        ])