parent
3793d36609
commit
43d489edda
3 changed files with 9 additions and 8 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
* Add tags to tumblr posts [#8244](https://github.com/diaspora/diaspora/pull/8244)
|
||||||
|
|
||||||
# 0.7.15.0
|
# 0.7.15.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ module Services
|
||||||
|
|
||||||
def request_to_external_blog(blogurl, body)
|
def request_to_external_blog(blogurl, body)
|
||||||
resp = client.post("/v2/blog/#{blogurl.host}/post", body)
|
resp = client.post("/v2/blog/#{blogurl.host}/post", body)
|
||||||
JSON.parse(resp.body)["response"]["id"] if resp.code == 201
|
JSON.parse(resp.body)["response"]["id"] if resp.code == "201"
|
||||||
end
|
end
|
||||||
|
|
||||||
def consumer_key
|
def consumer_key
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ describe Services::Tumblr, type: :model do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
user.services << service
|
user.services << service
|
||||||
stub_request(:get, "http://api.tumblr.com/v2/user/info").to_return(status: 200, body: user_info)
|
stub_request(:get, "https://api.tumblr.com/v2/user/info").to_return(status: 200, body: user_info)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with multiple blogs" do
|
context "with multiple blogs" do
|
||||||
|
|
@ -32,8 +32,8 @@ describe Services::Tumblr, type: :model do
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
blogs: [
|
blogs: [
|
||||||
{primary: false, url: "http://foo.tumblr.com"},
|
{primary: false, url: "https://foo.tumblr.com"},
|
||||||
{primary: true, url: "http://bar.tumblr.com"}
|
{primary: true, url: "https://bar.tumblr.com"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ describe Services::Tumblr, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "posts a status message to the primary blog and stores the id" do
|
it "posts a status message to the primary blog and stores the id" do
|
||||||
stub = stub_request(:post, "http://api.tumblr.com/v2/blog/bar.tumblr.com/post")
|
stub = stub_request(:post, "https://api.tumblr.com/v2/blog/bar.tumblr.com/post")
|
||||||
.with(post_request).to_return(post_response)
|
.with(post_request).to_return(post_response)
|
||||||
|
|
||||||
expect(post).to receive(:tumblr_ids=).with({"bar.tumblr.com" => post_id}.to_json)
|
expect(post).to receive(:tumblr_ids=).with({"bar.tumblr.com" => post_id}.to_json)
|
||||||
|
|
@ -53,10 +53,10 @@ describe Services::Tumblr, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a single blog" do
|
context "with a single blog" do
|
||||||
let(:user_info) { {response: {user: {blogs: [{url: "http://foo.tumblr.com"}]}}}.to_json }
|
let(:user_info) { {response: {user: {blogs: [{url: "https://foo.tumblr.com"}]}}}.to_json }
|
||||||
|
|
||||||
it "posts a status message to the returned blog" do
|
it "posts a status message to the returned blog" do
|
||||||
stub = stub_request(:post, "http://api.tumblr.com/v2/blog/foo.tumblr.com/post")
|
stub = stub_request(:post, "https://api.tumblr.com/v2/blog/foo.tumblr.com/post")
|
||||||
.with(post_request).to_return(post_response)
|
.with(post_request).to_return(post_response)
|
||||||
|
|
||||||
service.post(post)
|
service.post(post)
|
||||||
|
|
@ -80,7 +80,7 @@ describe Services::Tumblr, type: :model do
|
||||||
describe "#delete_from_service" do
|
describe "#delete_from_service" do
|
||||||
it "removes posts from tumblr" do
|
it "removes posts from tumblr" do
|
||||||
tumblr_ids = {"foodbar.tumblr.com" => post_id}.to_json
|
tumblr_ids = {"foodbar.tumblr.com" => post_id}.to_json
|
||||||
stub = stub_request(:post, "http://api.tumblr.com/v2/blog/foodbar.tumblr.com/post/delete")
|
stub = stub_request(:post, "https://api.tumblr.com/v2/blog/foodbar.tumblr.com/post/delete")
|
||||||
.with(body: {"id" => post_id}).to_return(status: 200)
|
.with(body: {"id" => post_id}).to_return(status: 200)
|
||||||
|
|
||||||
service.delete_from_service(tumblr_ids: tumblr_ids)
|
service.delete_from_service(tumblr_ids: tumblr_ids)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue