Пример #1
0
    def test_resolving(self):
        with mock.patch('email_normalizer._get_mx_servers') as patched_method, \
                mock.patch('email_normalizer.google.GoogleNormalizer.normalize') as google_normalize:

            patched_method.return_value = ['mx.google.com']
            normalize('test@under_google_mx.com')

            self.failUnless(patched_method.called)
            self.assertTrue(google_normalize.called)
Пример #2
0
    def test_resolving(self):
        with mock.patch('email_normalizer._get_mx_servers') as patched_method, \
                mock.patch('email_normalizer.google.GoogleNormalizer.normalize') as google_normalize:

            patched_method.return_value = ['mx.google.com']
            normalize('test@under_google_mx.com')

            self.failUnless(patched_method.called)
            self.assertTrue(google_normalize.called)
Пример #3
0
    def test_register_unregister(self):
        class FooBarNormalizer(BaseNormalizer):
            domains = ['foobar.com']

            @classmethod
            def normalize(cls, local_part, domain):
                local_part = local_part.split('--')[0]
                return '{0}@{1}'.format(local_part, domain)

        self.assertEqual(normalize('*****@*****.**', resolve=False),
                         '*****@*****.**')

        register_normalizer(FooBarNormalizer)
        self.assertEqual(normalize('*****@*****.**', resolve=False),
                         '*****@*****.**')

        unregister_normalizer(FooBarNormalizer)
        self.assertEqual(normalize('*****@*****.**', resolve=False),
                         '*****@*****.**')
Пример #4
0
    def test_override_default_normalizer(self):
        class MyNormalizer(BaseNormalizer):
            @classmethod
            def normalize(cls, local_part, domain):
                local_part = local_part.split('+')[0]
                return '{0}@{1}'.format(local_part, domain)

        self.assertEqual(
            normalize('*****@*****.**',
                      resolve=False,
                      default_normalizer=MyNormalizer), '*****@*****.**')
Пример #5
0
 def test_narod(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #6
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #7
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #8
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #9
0
 def test_default(self):
     self.assertEqual(normalize('*****@*****.**', resolve=False), '*****@*****.**')
Пример #10
0
 def test_yandexkz(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #11
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #12
0
 def test_yandexcom(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #13
0
 def test_yandexcom(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #14
0
 def test_dots_remove(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #15
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #16
0
 def test_domain_segments(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #17
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #18
0
 def test_yandexua(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #19
0
 def test_default(self):
     self.assertEqual(normalize('*****@*****.**', resolve=False),
                      '*****@*****.**')
Пример #20
0
 def test_yandexkz(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #21
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #22
0
 def test_yandexby(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #23
0
 def test_narod(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #24
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #25
0
 def test_yandexby(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #26
0
 def test_to_lower(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #27
0
 def test_yandexua(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #28
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'), '*****@*****.**')
Пример #29
0
 def test_to_lower(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #30
0
 def test_dots_remove(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #31
0
 def test_domain_segments(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')
Пример #32
0
 def test_extra(self):
     self.assertEqual(normalize('*****@*****.**'),
                      '*****@*****.**')