Skip to content

Commit

Permalink
Created yandex-hosted provider for yandex mail for domains
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibhas committed Jun 14, 2018
1 parent 4cb8eb8 commit f400580
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
docs/_build
build/
dist/
.pytest_cache
__pycache__
7 changes: 6 additions & 1 deletion mxsniff/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,19 @@
'title': "Yahoo Small Business",
},
'yandex': {'mx': [
'mx.yandex.net',
'mx.yandex.ru',
],
'title': "Yandex",
'domains': ['yandex.com', 'yandex.ru'],
'public': True,
'canonical_flags': {'lowercase': True},
},
'yandex-hosted': {'mx': [
'mx.yandex.net',
],
'title': "Yandex Mail for Domain",
'canonical_flags': {'lowercase': True},
},
'yodns': {'mx': [
'*.yodns.com',
]},
Expand Down
2 changes: 1 addition & 1 deletion runtests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
coverage run `which nosetests`
coverage run -m pytest "$@"
coverage report -m
Empty file added tests/__init__.py
Empty file.
30 changes: 30 additions & 0 deletions tests/test_sniff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import unittest
from mxsniff import mxsniff


class MXSniffTestCase(unittest.TestCase):
def test_mxsniff(self):
result = mxsniff('google.com')
self.assertFalse(result['public'])
self.assertIn('google-apps', result['match'])
self.assertGreater(len(result['mx']), 0)

result = mxsniff('gmail.com')
self.assertTrue(result['public'])
self.assertIn('google-gmail', result['match'])
self.assertEqual(len(result['mx']), 0)

result = mxsniff('hasgeek.com')
self.assertFalse(result['public'])
self.assertIn('google-apps', result['match'])
self.assertGreater(len(result['mx']), 0)

result = mxsniff('yandex.ru')
self.assertTrue(result['public'])
self.assertIn('yandex', result['match'])
self.assertEqual(len(result['mx']), 0)

result = mxsniff('vayve.in')
self.assertFalse(result['public'])
self.assertIn('yandex-hosted', result['match'])
self.assertGreater(len(result['mx']), 0)

0 comments on commit f400580

Please sign in to comment.