def test_success_submit_of_new_feedback(self):
        """Test success creation of the new feedback."""

        feedbacks_count = Feedback.objects.count()
        form = FeedbackForm(params=self.params)
        form.submit()
        self.assertEqual(Feedback.objects.count(), feedbacks_count + 1)
Exemple #2
0
def feedback():
    form = FeedbackForm()
    if form.validate_on_submit():
        form.save()
        flash(u'Thank you for your feedback', 'success')
        return redirect(url_for('parkings_app.search'))
    feedbacks = Feedback.objects.filter()
    return render_template('feedbacks/feedbacks.html',
                           form=form,
                           feedbacks=feedbacks)
    def test_success_update_of_feedback(self):
        """Test success updating of the feedback."""

        params = {**self.params, 'description': 'TEXT_TEXT'}
        feedback = FeedbackFactory(
            user_id=self.user_1.id,
            object_id=self.user_2.id,
            company_id=self.company.id,
            content_type=ContentType.objects.get_for_model(User))
        form = FeedbackForm(obj=feedback, params=params)
        form.submit()
        feedback.refresh_from_db()
        self.assertEqual(feedback.description, params.get('description'))
Exemple #4
0
 def test_feedback_form_min_value_is_greater_then_max_value(self, value):
     form = FeedbackForm(data=value)
     self.assertFalse(form.is_valid())
Exemple #5
0
 def test_feedback_form_min_value_is_less_then_max_value(self, value):
     form = FeedbackForm(data=value)
     self.assertTrue(form.is_valid())
    def test_failed_validation(self):
        """Test failed validation of the form."""

        form = FeedbackForm(params={})
        self.assertFalse(form.is_valid())
    def test_success_validation(self):
        """Test success validation of the form."""

        form = FeedbackForm(params=self.params)
        self.assertTrue(form.is_valid())