<s> from test . unit_tests . providers import common <EOL> from test . unit_tests . providers . common import ProviderTestCase <EOL> from totalimpact . providers . provider import Provider , ProviderContentMalformedError <EOL> from test . utils import http <EOL> import os <EOL> import collections <EOL> import json <EOL> from nose . tools import assert_equals , assert_items_equal , raises , nottest <EOL> class TestBlog_post ( ProviderTestCase ) : <EOL> provider_name = "<STR_LIT>" <EOL> testitem_aliases = ( '<STR_LIT>' , json . dumps ( { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } ) ) <EOL> testitem_aliases_not_wordpress_com = ( '<STR_LIT>' , json . dumps ( { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } ) ) <EOL> api_key = os . environ [ "<STR_LIT>" ] <EOL> def setUp ( self ) : <EOL> ProviderTestCase . setUp ( self ) <EOL> def test_is_relevant_alias ( self ) : <EOL> assert_equals ( self . provider . is_relevant_alias ( self . testitem_aliases ) , True ) <EOL> assert_equals ( self . provider . is_relevant_alias ( ( "<STR_LIT:url>" , "<STR_LIT>" ) ) , False ) <EOL> @ http <EOL> def test_aliases_wordpress_com ( self ) : <EOL> response = self . provider . aliases ( [ self . testitem_aliases ] ) <EOL> print response <EOL> expected = [ ( '<STR_LIT:url>' , u'<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> assert_equals ( response , expected ) <EOL> @ http <EOL> def test_aliases_not_wordpress ( self ) : <EOL> response = self . provider . aliases ( [ ( '<STR_LIT>' , json . dumps ( { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } ) ) ] ) <EOL> print response <EOL> expected = [ ( '<STR_LIT:url>' , u'<STR_LIT>' ) ] <EOL> assert_equals ( response , expected ) <EOL> @ http <EOL> def test_biblio_wordpress ( self ) : <EOL> response = self . provider . biblio ( [ self . testitem_aliases ] ) <EOL> print response <EOL> expected = { '<STR_LIT:url>' : u'<STR_LIT>' , '<STR_LIT>' : u'<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:title>' : '<STR_LIT>' } <EOL> assert_equals ( response , expected ) <EOL> @ http <EOL> def test_biblio_wordpress ( self ) : <EOL> response = self . provider . biblio ( [ self . testitem_aliases ] ) <EOL> print response <EOL> expected = { '<STR_LIT:url>' : u'<STR_LIT>' , '<STR_LIT>' : u'<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:title>' : '<STR_LIT>' } <EOL> assert_equals ( response , expected ) <EOL> @ http <EOL> def test_biblio_not_wordpress2 ( self ) : <EOL> test_alias = ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> response = self . provider . biblio ( [ test_alias ] ) <EOL> print response <EOL> expected = { '<STR_LIT:url>' : u'<STR_LIT>' , '<STR_LIT>' : u'<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:title>' : '<STR_LIT>' } <EOL> assert_equals ( response , expected ) <EOL> @ http <EOL> @ nottest <EOL> def test_metrics ( self ) : <EOL> wordpress_aliases = [ ( '<STR_LIT:url>' , u'<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> response = self . provider . metrics ( wordpress_aliases ) <EOL> print response <EOL> expected = { } <EOL> assert_equals ( response , expected ) <EOL> def test_provider_aliases_400 ( self ) : <EOL> pass <EOL> def test_provider_aliases_500 ( self ) : <EOL> pass <EOL> def test_provider_biblio_400 ( self ) : <EOL> pass <EOL> def test_provider_biblio_500 ( self ) : <EOL> pass <EOL> def test_provider_metrics_400 ( self ) : <EOL> pass <EOL> def test_provider_metrics_500 ( self ) : <EOL> pass <EOL> def test_provider_metrics_empty ( self ) : <EOL> pass <EOL> def test_provider_metrics_nonsense_txt ( self ) : <EOL> pass <EOL> def test_provider_metrics_nonsense_xml ( self ) : <EOL> pass </s>
