Fixed test

closes #8244
This commit is contained in:
Thorsten Claus 2021-05-14 20:21:35 +02:00 committed by Benjamin Neff
parent 3793d36609
commit 43d489edda
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
3 changed files with 9 additions and 8 deletions

View file

@ -7,6 +7,7 @@
## Bug fixes
## Features
* Add tags to tumblr posts [#8244](https://github.com/diaspora/diaspora/pull/8244)
# 0.7.15.0

View file

@ -64,7 +64,7 @@ module Services
def request_to_external_blog(blogurl, 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
def consumer_key

View file

@ -22,7 +22,7 @@ describe Services::Tumblr, type: :model do
before do
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
context "with multiple blogs" do
@ -32,8 +32,8 @@ describe Services::Tumblr, type: :model do
{
user: {
blogs: [
{primary: false, url: "http://foo.tumblr.com"},
{primary: true, url: "http://bar.tumblr.com"}
{primary: false, url: "https://foo.tumblr.com"},
{primary: true, url: "https://bar.tumblr.com"}
]
}
}
@ -41,7 +41,7 @@ describe Services::Tumblr, type: :model do
end
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)
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
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
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)
service.post(post)
@ -80,7 +80,7 @@ describe Services::Tumblr, type: :model do
describe "#delete_from_service" do
it "removes posts from tumblr" do
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)
service.delete_from_service(tumblr_ids: tumblr_ids)