def test_kwargs(self): d = processor.UrlData( domains=['twitter.com', 'facebook.com'], url='mock_url', foo='bar', ) self.assertEqual(['twitter.com', 'facebook.com'], d.domains) self.assertEqual('mock_url', d['url']) self.assertEqual('bar', d['foo'])
def test_zeroes(self): d = processor.UrlData(url='foo', http_response='bar', domains=['twitter.com', 'facebook.com']) expected = { 'domain_0': 'not found', 'domain_0_count': 0, 'domain_1': 'not found', 'domain_1_count': 0, 'url': 'foo', 'http_response': 'bar' } self.assertEqual(expected, d.data)
def test_follow_nofollow(self): d = processor.UrlData(url='foo', http_response='bar', domains=['twitter.com', 'facebook.com']) d.add('facebook.com', False) d.add('facebook.com', True) expected = { 'domain_0': 'not found', 'domain_0_count': 0, 'domain_1': 'follow', 'domain_1_count': 2, 'url': 'foo', 'http_response': 'bar' } self.assertEqual(expected, d.data)
def setUp(self): self.d = processor.UrlData( domains=['twitter.com', 'facebook.com'], )
def test_empty(self): d = processor.UrlData(domains=[], url='foo', http_response='bar') expected = {'url': 'foo', 'http_response': 'bar'} self.assertEqual(expected, d.data)