test/test_tumblr.rb in tumblr-rb-1.1.1 vs test/test_tumblr.rb in tumblr-rb-1.2.0
- old
+ new
@@ -108,10 +108,16 @@
assert_respond_to tumbl, :authenticate
assert tumbl.authenticate.is_a? Weary::Request
assert_equal auth.uri, tumbl.authenticate.uri
end
+ test 'can pass include theme params to authenticate method' do
+ tumbl = Tumblr.new('test@testermcgee.com','dontrevealmysecrets')
+ include_theme = tumbl.authenticate(true)
+ assert include_theme.with.split('&').include?("include-theme=1")
+ end
+
test 'executes' do
cred = {:email => 'test@testermcgee.com', :password => 'dontrevealmysecrets'}
response = VCR.with_cassette('write/write') do
Tumblr.execute(cred, 'Hello World.')
end
@@ -250,10 +256,25 @@
posts = VCR.with_cassette('read/authenticated') do
reader.get_all_posts('mwunsch')
end
assert_equal 66, posts.count
end
+
+ test 'read pages' do
+ reader = Tumblr::Reader.new
+ assert_respond_to reader, :pages
+ response = hijack! reader.pages('tumblrgemtest'), 'read/pages'
+ assert response['tumblr'].has_key?("pages")
+ end
+
+ test 'reads all pages by authenticating' do
+ reader = Tumblr::Reader.new('test@testermcgee.com','dontrevealmysecrets')
+ assert_respond_to reader, :all_pages
+ response = hijack! reader.all_pages('tumblrgemtest'), 'read/all_pages'
+ assert_equal 200, response.code
+ assert_equal 2, response['tumblr']['pages']['page'].count
+ end
end
describe 'Writer' do
test 'sets up credentials for authentication' do
writer = Tumblr::Writer
@@ -303,9 +324,14 @@
user = Tumblr::Authenticator.new('test@testermcgee.com','dontrevealmysecrets')
assert_respond_to user, :authenticate
response = hijack! user.authenticate, 'authenticate/authenticate'
assert response.success?
assert_equal 'mwunsch', response["tumblr"]["tumblelog"].first["name"]
+ end
+
+ test 'can include an optional theme' do
+ user = Tumblr::Authenticator.new('test@testermcgee.com','dontrevealmysecrets')
+ assert user.authenticate(:'include-theme' => 1).with.split('&').include?("include-theme=1")
end
end
describe 'Post' do
describe 'Basic' do