<filename>tests/unit/catalogue/reviews/form_tests.py<gh_stars>1-10
from django.test import TestCase
from nose.plugins.attrib import attr

from oscar.apps.catalogue.reviews import forms


@attr('reviews')
class TestReviewForm(TestCase):

    def setUp(self):
        self.data = {
            'title': 'This product is lovely',
            'body': 'I really like this cheese',
            'score': 0,
            'name': '<NAME>',
            'email': '<EMAIL>'
        }

    def form(self, **kwargs):
        data = self.data.copy()
        data.update(kwargs)
        return forms.ProductReviewForm(product=None, user=None, data=data)

    def test_validates_empty_data_correctly(self):
        forms.ProductReviewForm(product=None, user=None, data={}).is_valid()

    def test_validates_correctly(self):
        self.assertTrue(self.form().is_valid())

<filename>tests/unit/catalogue/reviews/form_tests.py<gh_stars>1-10
from django.test import TestCase
from nose.plugins.attrib import attr

from oscar.apps.catalogue.reviews import forms


@attr('reviews')
class TestReviewForm(TestCase):

    def setUp(self):
        self.data = {
            'title': 'This product is lovely',
            'body': 'I really like this cheese',
            'score': 0,
            'name': '<NAME>',
            'email': '<EMAIL>'
        }

    def form(self, **kwargs):
        data = self.data.copy()
        data.update(kwargs)
        return forms.ProductReviewForm(product=None, user=None, data=data)

    def test_validates_empty_data_correctly(self):
        forms.ProductReviewForm(product=None, user=None, data={}).is_valid()

    def test_validates_correctly(self):
        self.assertTrue(self.form().is_valid())
