#NEWLINE# def test_should_parse_domain_info( self ) : #NEWLINE# #INDENT# seeds = [ Request ( 'http://example.com' ) , Request ( 'https://www.google.com' ) ] #NEWLINE# mware = DomainMiddleware ( self . fake_manager ) #NEWLINE# result = mware . add_seeds ( seeds ) #NEWLINE# self . assertEquals ( len ( result ) , len ( seeds ) ) #NEWLINE# for r in result : #NEWLINE# #INDENT# self . assertIn ( 'domain' , r . meta , ( 'Missing domain info for %r' % r ) ) #NEWLINE# #UNINDENT# expected = [ { #NEWLINE# #INDENT# 'name' : 'example.com' , #NEWLINE# 'netloc' : 'example.com' , #NEWLINE# 'scheme' : 'http' , #NEWLINE# 'sld' : '' , #NEWLINE# 'subdomain' : '' , #NEWLINE# 'tld' : '' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'www.google.com' , #NEWLINE# 'netloc' : 'www.google.com' , #NEWLINE# 'scheme' : 'https' , #NEWLINE# 'sld' : '' , #NEWLINE# 'subdomain' : '' , #NEWLINE# 'tld' : '' , #NEWLINE# #UNINDENT# } ] #NEWLINE# self . assertEquals ( expected , [ r . meta [ 'domain' ] for r in result ] )