remove unused auth & added test

This commit is contained in:
jem 2020-06-26 16:45:45 +02:00
parent dbc5f8cd25
commit 843064899b
2 changed files with 17 additions and 9 deletions

View file

@ -110,8 +110,7 @@
; TODO: move this to mastodon-api - seems to belong strongly to mastodon
(defn-spec intermediate-to-mastodon mastodon-output?
[mastodon-auth masto/mastodon-auth?
target masto/mastodon-target?
[target masto/mastodon-target?
input input?]
(let [{:keys [created-at text media-links screen_name untrimmed-text]} input
{:keys [signature append-screen-name?]} target
@ -149,7 +148,7 @@
(map #(intermediate-resolve-urls resolve-urls? %))
(map #(twitter/nitter-url source %))
(map #(perform-replacements transformation %))
(map #(intermediate-to-mastodon mastodon-auth target %))
(map #(intermediate-to-mastodon target %))
(masto/post-items mastodon-auth target))))))
(defn-spec tweets-to-mastodon any?
@ -182,7 +181,7 @@
(filter #(> (:created-at %) last-post-time))
(remove #(blocked-content? transformation (:text %)))
(map #(perform-replacements transformation %))
(map #(intermediate-to-mastodon mastodon-auth target %))
(map #(intermediate-to-mastodon target %))
(masto/post-items mastodon-auth target))))))
(defn-spec tumblr-to-mastodon any?
@ -214,9 +213,9 @@
(filter #(> (:created-at %) last-post-time))
(remove #(blocked-content? transformation (:text %)))
(map #(intermediate-resolve-urls resolve-urls? %))
(infra/debug-first)
(map #(perform-replacements transformation %))
(map #(intermediate-to-mastodon mastodon-auth target %))
(map #(intermediate-to-mastodon target %))
(infra/debug-first)
(masto/post-items mastodon-auth target)))))

View file

@ -8,8 +8,17 @@
(def intermediate-rss-item {:created-at #inst "2020-06-26T12:17:33.000-00:00"
:text "Taking Theatre Online with WebGL and WebRTC\n\nhttps://chrisuehlinger.com/blog/2020/06/16/unshattering-the-audience-building-theatre-on-the-web-in-2020/"})
(deftest should-resolve-urls
(deftest should-not-resolve-urls
(is (= {:created-at #inst "2020-06-26T12:17:33.000-00:00"
:text "Taking Theatre Online with WebGL and WebRTC\n\nhttps://chrisuehlinger.com/blog/2020/06/16/unshattering-the-audience-building-theatre-on-the-web-in-2020/"}
(sut/intermediate-resolve-urls false intermediate-rss-item)))
)
(sut/intermediate-resolve-urls false intermediate-rss-item))))
(deftest should-not-trim
(is (= {:created-at #inst "2020-06-26T12:17:33.000-00:00",
:text "Taking Theatre Online with WebGL and WebRTC\n\nhttps://chrisuehlinger.com/blog/2020/06/16/unshattering-the-audience-building-theatre-on-the-web-in-2020/\n#\n#rssbot",
:reblogged true, :media-links nil}
(sut/intermediate-to-mastodon {:target-type :mastodon
:append-screen-name? false
:max-post-length 500
:signature "#rssbot"}
intermediate-rss-item))))