Ejemplo n.º 1
0
class SeparatedValuesFieldTestCase(TestCase):

    def setUp(self):
        super(SeparatedValuesFieldTestCase, self).setUp()
        self.field = SeparatedValuesField(forms.EmailField)

    def test_email_field(self):
        assert self.field.clean(u'[email protected], [email protected]') == u'[email protected], [email protected]'

    def test_email_field_w_empties(self):
        assert (self.field.clean(u'[email protected],,   \n,[email protected]') ==
                u'[email protected], [email protected]')

    def test_email_validation_error(self):
        with self.assertRaises(exceptions.ValidationError):
            self.field.clean(u'e')
        with self.assertRaises(exceptions.ValidationError):
            self.field.clean(u'[email protected], [email protected], e')

    def test_url_field(self):
        field = SeparatedValuesField(forms.URLField)
        assert (field.clean(u'http://hy.fr/,,http://yo.lo') ==
                u'http://hy.fr/, http://yo.lo/')

    def test_alt_separator(self):
        self.field = SeparatedValuesField(forms.EmailField, separator='#')
        assert self.field.clean(u'[email protected]#[email protected]') == u'[email protected], [email protected]'
Ejemplo n.º 2
0
class SeparatedValuesFieldTestCase(TestCase):
    def setUp(self):
        super(SeparatedValuesFieldTestCase, self).setUp()
        self.field = SeparatedValuesField(forms.EmailField)

    def test_email_field(self):
        eq_(self.field.clean(u'[email protected], [email protected]'), u'[email protected], [email protected]')

    def test_email_field_w_empties(self):
        eq_(self.field.clean(u'[email protected],,   \n,[email protected]'), u'[email protected], [email protected]')

    def test_email_validation_error(self):
        with self.assertRaises(exceptions.ValidationError):
            self.field.clean(u'e')
        with self.assertRaises(exceptions.ValidationError):
            self.field.clean(u'[email protected], [email protected], e')

    def test_url_field(self):
        field = SeparatedValuesField(forms.URLField)
        eq_(field.clean(u'http://hy.fr/,,http://yo.lo'),
            u'http://hy.fr/, http://yo.lo/')

    def test_alt_separator(self):
        self.field = SeparatedValuesField(forms.EmailField, separator='#')
        eq_(self.field.clean(u'[email protected]#[email protected]'), u'[email protected], [email protected]')
Ejemplo n.º 3
0
class SeparatedValuesFieldTestCase(TestCase):
    def setUp(self):
        super(SeparatedValuesFieldTestCase, self).setUp()
        self.field = SeparatedValuesField(forms.EmailField)

    def test_email_field(self):
        eq_(self.field.clean(u"[email protected], [email protected]"), u"[email protected], [email protected]")

    def test_email_field_w_empties(self):
        eq_(self.field.clean(u"[email protected],,   \n,[email protected]"), u"[email protected], [email protected]")

    def test_email_validation_error(self):
        with self.assertRaises(exceptions.ValidationError):
            self.field.clean(u"e")
        with self.assertRaises(exceptions.ValidationError):
            self.field.clean(u"[email protected], [email protected], e")

    def test_url_field(self):
        field = SeparatedValuesField(forms.URLField)
        eq_(field.clean(u"http://hy.fr/,,http://yo.lo"), u"http://hy.fr/, http://yo.lo/")

    def test_alt_separator(self):
        self.field = SeparatedValuesField(forms.EmailField, separator="#")
        eq_(self.field.clean(u"[email protected]#[email protected]"), u"[email protected], [email protected]")
Ejemplo n.º 4
0
 def test_alt_separator(self):
     self.field = SeparatedValuesField(forms.EmailField, separator='#')
     eq_(self.field.clean(u'[email protected]#[email protected]'), u'[email protected], [email protected]')
Ejemplo n.º 5
0
 def test_url_field(self):
     field = SeparatedValuesField(forms.URLField)
     eq_(field.clean(u'http://hy.fr/,,http://yo.lo'),
         u'http://hy.fr/, http://yo.lo/')
Ejemplo n.º 6
0
 def setUp(self):
     super(SeparatedValuesFieldTestCase, self).setUp()
     self.field = SeparatedValuesField(forms.EmailField)
Ejemplo n.º 7
0
 def test_alt_separator(self):
     self.field = SeparatedValuesField(forms.EmailField, separator="#")
     eq_(self.field.clean(u"[email protected]#[email protected]"), u"[email protected], [email protected]")
Ejemplo n.º 8
0
 def test_url_field(self):
     field = SeparatedValuesField(forms.URLField)
     eq_(field.clean(u"http://hy.fr/,,http://yo.lo"), u"http://hy.fr/, http://yo.lo/")
Ejemplo n.º 9
0
 def setUp(self):
     super(SeparatedValuesFieldTestCase, self).setUp()
     self.field = SeparatedValuesField(forms.EmailField)
Ejemplo n.º 10
0
 def test_alt_separator(self):
     self.field = SeparatedValuesField(forms.EmailField, separator='#')
     assert self.field.clean(u'[email protected]#[email protected]') == u'[email protected], [email protected]'
Ejemplo n.º 11
0
 def test_url_field(self):
     field = SeparatedValuesField(forms.URLField)
     assert (field.clean(u'http://hy.fr/,,http://yo.lo') ==
             u'http://hy.fr/, http://yo.lo/')