<s> import nose <EOL> import unittest <EOL> import mock <EOL> import json <EOL> import io <EOL> from httpretty import HTTPretty , httprettified <EOL> import pytumblr <EOL> from urlparse import parse_qs <EOL> class TumblrRestClientTest ( unittest . TestCase ) : <EOL> """<STR_LIT:U+0020>""" <EOL> def setUp ( self ) : <EOL> with open ( '<STR_LIT>' , '<STR_LIT:r>' ) as f : <EOL> credentials = json . loads ( f . read ( ) ) <EOL> self . client = pytumblr . TumblrRestClient ( credentials [ '<STR_LIT>' ] , credentials [ '<STR_LIT>' ] , credentials [ '<STR_LIT>' ] , credentials [ '<STR_LIT>' ] ) <EOL> @ httprettified <EOL> def test_dashboard ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . dashboard ( ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_posts ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . posts ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_posts_with_type ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . posts ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_posts_with_type_and_arg ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> args = { '<STR_LIT>' : <NUM_LIT:1> } <EOL> response = self . client . posts ( '<STR_LIT>' , '<STR_LIT>' , ** args ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_blogInfo ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . blog_info ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == { } <EOL> @ httprettified <EOL> def test_followers ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . followers ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_blogLikes ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . blog_likes ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_blogLikes_with_after ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . blog_likes ( '<STR_LIT>' , after = <NUM_LIT> ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_blogLikes_with_before ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . blog_likes ( '<STR_LIT>' , before = <NUM_LIT> ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_queue ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . queue ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_drafts ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . drafts ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_submissions ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . submission ( '<STR_LIT>' ) <EOL> assert response [ '<STR_LIT>' ] == [ ] <EOL> @ httprettified <EOL> def test_follow ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . follow ( "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == "<STR_LIT:POST>" <EOL> assert experimental_body [ '<STR_LIT:url>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> @ httprettified <EOL> def test_unfollow ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . unfollow ( "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == "<STR_LIT:POST>" <EOL> assert experimental_body [ '<STR_LIT:url>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> @ httprettified <EOL> def test_reblog ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . reblog ( '<STR_LIT>' , id = '<STR_LIT>' , reblog_key = "<STR_LIT>" , state = '<STR_LIT>' , tags = [ '<STR_LIT:hello>' , '<STR_LIT>' ] ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == '<STR_LIT:POST>' <EOL> assert experimental_body [ '<STR_LIT:id>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT:state>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> @ httprettified <EOL> def test_edit_post ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . edit_post ( '<STR_LIT>' , id = '<STR_LIT>' , state = '<STR_LIT>' , tags = [ '<STR_LIT:hello>' , '<STR_LIT>' ] ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == '<STR_LIT:POST>' <EOL> assert experimental_body [ '<STR_LIT:id>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT:state>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> @ httprettified <EOL> def test_like ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . like ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == "<STR_LIT:POST>" <EOL> assert experimental_body [ '<STR_LIT:id>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> @ httprettified <EOL> def test_unlike ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . unlike ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == "<STR_LIT:POST>" <EOL> assert experimental_body [ '<STR_LIT:id>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> assert experimental_body [ '<STR_LIT>' ] [ <NUM_LIT:0> ] == '<STR_LIT>' <EOL> @ httprettified <EOL> def test_info ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . info ( ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_likes ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . likes ( ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_likes_with_after ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . likes ( after = <NUM_LIT> ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_likes_with_before ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . likes ( before = <NUM_LIT> ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_following ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . following ( ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_tagged ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . GET , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . tagged ( '<STR_LIT>' ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_create_text ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_text ( '<STR_LIT>' , body = "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_create_link ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_link ( '<STR_LIT>' , url = "<STR_LIT>" , tags = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert response == [ ] <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert HTTPretty . last_request . method == "<STR_LIT:POST>" <EOL> assert experimental_body [ '<STR_LIT>' ] [ <NUM_LIT:0> ] == "<STR_LIT>" <EOL> @ httprettified <EOL> def test_no_tags ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_link ( '<STR_LIT>' , tags = [ ] ) <EOL> experimental_body = parse_qs ( HTTPretty . last_request . body ) <EOL> assert '<STR_LIT>' not in experimental_body <EOL> @ httprettified <EOL> def test_create_quote ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_quote ( '<STR_LIT>' , quote = "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_create_chat ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_chat ( '<STR_LIT>' , conversation = "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_create_photo ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_photo ( '<STR_LIT>' , source = "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_create_audio ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_audio ( '<STR_LIT>' , external_url = "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> @ httprettified <EOL> def test_create_video ( self ) : <EOL> HTTPretty . register_uri ( HTTPretty . POST , '<STR_LIT>' , <EOL> body = '<STR_LIT>' ) <EOL> response = self . client . create_video ( '<STR_LIT>' , embed = "<STR_LIT>" ) <EOL> assert response == [ ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
