コード例 #1
0
ファイル: test_fields.py プロジェクト: aelawson/addons-server
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]'
コード例 #2
0
ファイル: test_fields.py プロジェクト: kewisch/addons-server
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]')
コード例 #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]")
コード例 #4
0
ファイル: test_fields.py プロジェクト: kewisch/addons-server
 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]')
コード例 #5
0
ファイル: test_fields.py プロジェクト: kewisch/addons-server
 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/')
コード例 #6
0
ファイル: test_fields.py プロジェクト: kewisch/addons-server
 def setUp(self):
     super(SeparatedValuesFieldTestCase, self).setUp()
     self.field = SeparatedValuesField(forms.EmailField)
コード例 #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]")
コード例 #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/")
コード例 #9
0
 def setUp(self):
     super(SeparatedValuesFieldTestCase, self).setUp()
     self.field = SeparatedValuesField(forms.EmailField)
コード例 #10
0
ファイル: test_fields.py プロジェクト: aelawson/addons-server
 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]'
コード例 #11
0
ファイル: test_fields.py プロジェクト: aelawson/addons-server
 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/')