def test_get_validation_errors(): domains = { 'linux.ru': False, 'linux': True, 'linux.nonexistent': True, 'www.linux.ru': True, } for domain, has_validation_errors in domains.iteritems(): errors = get_validation_errors(domain) eq_(errors != [], has_validation_errors, 'Unexpected error status for %s: %s' % (domain, errors))
def test_rf_domains(): long_domain = (u'пушкин-' * 6) + u'пушкин.рф' domains = { u'пушкин-66.рф': True, u'а.рф': False, u'google.рф': False, u'-пушкин.рф': False, u'пушкин-.рф': False, long_domain: False, } for domain, valid in domains.iteritems(): errors = get_validation_errors(normalize_domain_name(domain)) eq_(errors == [], valid, 'Unexpected error status for %s: %s' % (domain, errors))