1
0
mirror of https://github.com/danbee/micropub.git synced 2025-03-04 08:59:13 +00:00

Remove /main

This commit is contained in:
Daniel Barber 2022-08-16 22:10:44 -05:00
parent 0827022bf0
commit 2dac20c0b4
3 changed files with 11 additions and 11 deletions

View File

@ -19,14 +19,14 @@ module Micropub
json request.env json request.env
end end
get "/micropub/main" do get "/micropub" do
json data: { json data: {
posts: github.posts, posts: github.posts,
photos: github.photos, photos: github.photos,
} }
end end
post "/micropub/main" do post "/micropub" do
if valid_token? if valid_token?
post = Post.new(post_params) post = Post.new(post_params)

View File

@ -13,7 +13,7 @@ describe "auth" do
end end
it "rejects authentication without a token" do it "rejects authentication without a token" do
post "/micropub/main", { post "/micropub", {
content: "Hello, World!" content: "Hello, World!"
} }
@ -22,7 +22,7 @@ describe "auth" do
it "authenticates with a header" do it "authenticates with a header" do
header "Authorization", "Bearer #{@auth_token}" header "Authorization", "Bearer #{@auth_token}"
post "/micropub/main", { post "/micropub", {
content: "Hello, World!" content: "Hello, World!"
} }
@ -30,7 +30,7 @@ describe "auth" do
end end
it "authenticates with a form param" do it "authenticates with a form param" do
post "/micropub/main", { post "/micropub", {
access_token: @auth_token, access_token: @auth_token,
content: "Hello, World!" content: "Hello, World!"
} }

View File

@ -9,7 +9,7 @@ describe "create post" do
end end
it "creates a simple post" do it "creates a simple post" do
post "/micropub/main", { post "/micropub", {
content: "Hello, World!" content: "Hello, World!"
} }
@ -20,7 +20,7 @@ describe "create post" do
end end
it "creates a post with a title" do it "creates a post with a title" do
post "/micropub/main", { post "/micropub", {
name: "My money's in that office, right?", name: "My money's in that office, right?",
content: <<~CONTENT, content: <<~CONTENT,
If she start giving me some bullshit about it ain"t there, and we got If she start giving me some bullshit about it ain"t there, and we got
@ -37,7 +37,7 @@ describe "create post" do
end end
it "creates a post with a single category" do it "creates a post with a single category" do
post "/micropub/main", { post "/micropub", {
content: "Hello, World!", content: "Hello, World!",
category: "my-blog", category: "my-blog",
} }
@ -49,7 +49,7 @@ describe "create post" do
end end
it "creates a post with multiple categories" do it "creates a post with multiple categories" do
post "/micropub/main", { post "/micropub", {
content: "Hello, World!", content: "Hello, World!",
category: ["one", "two", "three"], category: ["one", "two", "three"],
} }
@ -69,7 +69,7 @@ describe "create post" do
}, },
}.to_json }.to_json
post "/micropub/main", post_json, { "CONTENT_TYPE" => "application/json" } post "/micropub", post_json, { "CONTENT_TYPE" => "application/json" }
date = Time.now.strftime("%Y/%m/%d") date = Time.now.strftime("%Y/%m/%d")
assert last_response.accepted? assert last_response.accepted?
@ -86,7 +86,7 @@ describe "create post" do
}, },
}.to_json }.to_json
post "/micropub/main", post_json, { "CONTENT_TYPE" => "application/json" } post "/micropub", post_json, { "CONTENT_TYPE" => "application/json" }
date = Time.now.strftime("%Y/%m/%d") date = Time.now.strftime("%Y/%m/%d")
assert last_response.accepted? assert last_response.accepted?