Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

813 lines
22KB

  1. defmodule HTTPoisonMock do
  2. alias HTTPoison.Response
  3. def get(url, body \\ [], headers \\ [])
  4. def get("https://info.pleroma.site/activity.json", _, _) do
  5. {:ok,
  6. %Response{
  7. status_code: 200,
  8. body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
  9. }}
  10. end
  11. def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
  12. {:ok,
  13. %Response{
  14. status_code: 200,
  15. body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
  16. }}
  17. end
  18. def get(
  19. "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
  20. [Accept: "application/xrd+xml,application/jrd+json"],
  21. follow_redirect: true
  22. ) do
  23. {:ok,
  24. %Response{
  25. status_code: 200,
  26. body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
  27. }}
  28. end
  29. def get(
  30. "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
  31. [Accept: "application/xrd+xml,application/jrd+json"],
  32. follow_redirect: true
  33. ) do
  34. {:ok,
  35. %Response{
  36. status_code: 200,
  37. body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
  38. }}
  39. end
  40. def get(
  41. "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
  42. [Accept: "application/xrd+xml,application/jrd+json"],
  43. follow_redirect: true
  44. ) do
  45. {:ok,
  46. %Response{
  47. status_code: 200,
  48. body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
  49. }}
  50. end
  51. def get(
  52. "https://social.heldscal.la/.well-known/webfinger",
  53. [Accept: "application/xrd+xml,application/jrd+json"],
  54. params: [resource: "nonexistant@social.heldscal.la"],
  55. follow_redirect: true
  56. ) do
  57. {:ok,
  58. %Response{
  59. status_code: 500,
  60. body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
  61. }}
  62. end
  63. def get(
  64. "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
  65. [Accept: "application/xrd+xml,application/jrd+json"],
  66. follow_redirect: true
  67. ) do
  68. {:ok,
  69. %Response{
  70. status_code: 200,
  71. body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
  72. }}
  73. end
  74. def get(
  75. "https://social.heldscal.la/.well-known/webfinger",
  76. [Accept: "application/xrd+xml,application/jrd+json"],
  77. params: [resource: "shp@social.heldscal.la"],
  78. follow_redirect: true
  79. ) do
  80. {:ok,
  81. %Response{
  82. status_code: 200,
  83. body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
  84. }}
  85. end
  86. def get(
  87. "https://social.heldscal.la/.well-known/webfinger",
  88. [Accept: "application/xrd+xml,application/jrd+json"],
  89. params: [resource: "https://social.heldscal.la/user/23211"],
  90. follow_redirect: true
  91. ) do
  92. {:ok,
  93. %Response{
  94. status_code: 200,
  95. body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
  96. }}
  97. end
  98. def get(
  99. "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
  100. [Accept: "application/xrd+xml,application/jrd+json"],
  101. follow_redirect: true
  102. ) do
  103. {:ok,
  104. %Response{
  105. status_code: 200,
  106. body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
  107. }}
  108. end
  109. def get(
  110. "https://social.heldscal.la/.well-known/webfinger",
  111. [Accept: "application/xrd+xml,application/jrd+json"],
  112. params: [resource: "https://social.heldscal.la/user/29191"],
  113. follow_redirect: true
  114. ) do
  115. {:ok,
  116. %Response{
  117. status_code: 200,
  118. body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
  119. }}
  120. end
  121. def get(
  122. "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
  123. [Accept: "application/xrd+xml,application/jrd+json"],
  124. follow_redirect: true
  125. ) do
  126. {:ok,
  127. %Response{
  128. status_code: 200,
  129. body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
  130. }}
  131. end
  132. def get(
  133. "https://mastodon.social/.well-known/webfinger",
  134. [Accept: "application/xrd+xml,application/jrd+json"],
  135. params: [resource: "https://mastodon.social/users/lambadalambda"],
  136. follow_redirect: true
  137. ) do
  138. {:ok,
  139. %Response{
  140. status_code: 200,
  141. body:
  142. File.read!(
  143. "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
  144. )
  145. }}
  146. end
  147. def get(
  148. "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
  149. [Accept: "application/xrd+xml,application/jrd+json"],
  150. follow_redirect: true
  151. ) do
  152. {:ok,
  153. %Response{
  154. status_code: 200,
  155. body:
  156. File.read!(
  157. "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
  158. )
  159. }}
  160. end
  161. def get(
  162. "https://shitposter.club/.well-known/webfinger",
  163. [Accept: "application/xrd+xml,application/jrd+json"],
  164. params: [resource: "https://shitposter.club/user/1"],
  165. follow_redirect: true
  166. ) do
  167. {:ok,
  168. %Response{
  169. status_code: 200,
  170. body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
  171. }}
  172. end
  173. def get(
  174. "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
  175. [Accept: "application/xrd+xml,application/jrd+json"],
  176. follow_redirect: true
  177. ) do
  178. {:ok,
  179. %Response{
  180. status_code: 200,
  181. body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
  182. }}
  183. end
  184. def get(
  185. "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
  186. [Accept: "application/xrd+xml,application/jrd+json"],
  187. follow_redirect: true
  188. ) do
  189. {:ok,
  190. %Response{
  191. status_code: 200,
  192. body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
  193. }}
  194. end
  195. def get(
  196. "http://gs.example.org/.well-known/webfinger",
  197. [Accept: "application/xrd+xml,application/jrd+json"],
  198. params: [resource: "http://gs.example.org:4040/index.php/user/1"],
  199. follow_redirect: true
  200. ) do
  201. {:ok,
  202. %Response{
  203. status_code: 200,
  204. body:
  205. File.read!(
  206. "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
  207. )
  208. }}
  209. end
  210. def get(
  211. "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
  212. [Accept: "application/xrd+xml,application/jrd+json"],
  213. follow_redirect: true
  214. ) do
  215. {:ok,
  216. %Response{
  217. status_code: 200,
  218. body:
  219. File.read!(
  220. "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
  221. )
  222. }}
  223. end
  224. def get(
  225. "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
  226. [Accept: "application/xrd+xml,application/jrd+json"],
  227. follow_redirect: true
  228. ) do
  229. {:ok,
  230. %Response{
  231. status_code: 200,
  232. body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
  233. }}
  234. end
  235. def get(
  236. "https://pleroma.soykaf.com/.well-known/webfinger",
  237. [Accept: "application/xrd+xml,application/jrd+json"],
  238. params: [resource: "https://pleroma.soykaf.com/users/lain"],
  239. follow_redirect: true
  240. ) do
  241. {:ok,
  242. %Response{
  243. status_code: 200,
  244. body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
  245. }}
  246. end
  247. def get(
  248. "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
  249. [Accept: "application/xrd+xml,application/jrd+json"],
  250. follow_redirect: true
  251. ) do
  252. {:ok,
  253. %Response{
  254. status_code: 200,
  255. body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
  256. }}
  257. end
  258. def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
  259. {:ok,
  260. %Response{
  261. status_code: 200,
  262. body:
  263. File.read!(
  264. "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
  265. )
  266. }}
  267. end
  268. def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
  269. {:ok,
  270. %Response{
  271. status_code: 200,
  272. body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
  273. }}
  274. end
  275. def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
  276. {:ok,
  277. %Response{
  278. status_code: 200,
  279. body:
  280. File.read!(
  281. "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
  282. )
  283. }}
  284. end
  285. def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
  286. {:ok,
  287. %Response{
  288. status_code: 200,
  289. body:
  290. File.read!(
  291. "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
  292. )
  293. }}
  294. end
  295. def get(
  296. "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
  297. _body,
  298. _headers
  299. ) do
  300. {:ok,
  301. %Response{
  302. status_code: 200,
  303. body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
  304. }}
  305. end
  306. def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
  307. {:ok,
  308. %Response{
  309. status_code: 200,
  310. body:
  311. File.read!(
  312. "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
  313. )
  314. }}
  315. end
  316. def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
  317. {:ok,
  318. %Response{
  319. status_code: 200,
  320. body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
  321. }}
  322. end
  323. def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
  324. {:ok,
  325. %Response{
  326. status_code: 200,
  327. body:
  328. File.read!(
  329. "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
  330. )
  331. }}
  332. end
  333. def get("https://shitposter.club/notice/2827873", _body, _headers) do
  334. {:ok,
  335. %Response{
  336. status_code: 200,
  337. body:
  338. File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
  339. }}
  340. end
  341. def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
  342. {:ok,
  343. %Response{
  344. status_code: 200,
  345. body:
  346. File.read!(
  347. "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
  348. )
  349. }}
  350. end
  351. def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
  352. {:ok,
  353. %Response{
  354. status_code: 200,
  355. body:
  356. File.read!(
  357. "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
  358. )
  359. }}
  360. end
  361. def post(
  362. "https://social.heldscal.la/main/push/hub",
  363. {:form, _data},
  364. "Content-type": "application/x-www-form-urlencoded"
  365. ) do
  366. {:ok,
  367. %Response{
  368. status_code: 202
  369. }}
  370. end
  371. def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
  372. {:ok,
  373. %Response{
  374. status_code: 200,
  375. body:
  376. File.read!(
  377. "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
  378. )
  379. }}
  380. end
  381. def get(
  382. "https://pawoo.net/.well-known/webfinger",
  383. [Accept: "application/xrd+xml,application/jrd+json"],
  384. params: [resource: "https://pawoo.net/users/pekorino"],
  385. follow_redirect: true
  386. ) do
  387. {:ok,
  388. %Response{
  389. status_code: 200,
  390. body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
  391. }}
  392. end
  393. def get(
  394. "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
  395. [Accept: "application/xrd+xml,application/jrd+json"],
  396. follow_redirect: true
  397. ) do
  398. {:ok,
  399. %Response{
  400. status_code: 200,
  401. body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
  402. }}
  403. end
  404. def get("https://pawoo.net/users/pekorino.atom", _, _) do
  405. {:ok,
  406. %Response{
  407. status_code: 200,
  408. body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
  409. }}
  410. end
  411. def get(
  412. "https://mamot.fr/.well-known/webfinger",
  413. [Accept: "application/xrd+xml,application/jrd+json"],
  414. params: [resource: "https://mamot.fr/users/Skruyb"],
  415. follow_redirect: true
  416. ) do
  417. {:ok,
  418. %Response{
  419. status_code: 200,
  420. body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
  421. }}
  422. end
  423. def get(
  424. "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
  425. [Accept: "application/xrd+xml,application/jrd+json"],
  426. follow_redirect: true
  427. ) do
  428. {:ok,
  429. %Response{
  430. status_code: 200,
  431. body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
  432. }}
  433. end
  434. def get(
  435. "https://social.sakamoto.gq/.well-known/webfinger",
  436. [Accept: "application/xrd+xml,application/jrd+json"],
  437. params: [resource: "https://social.sakamoto.gq/users/eal"],
  438. follow_redirect: true
  439. ) do
  440. {:ok,
  441. %Response{
  442. status_code: 200,
  443. body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
  444. }}
  445. end
  446. def get(
  447. "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
  448. [Accept: "application/xrd+xml,application/jrd+json"],
  449. follow_redirect: true
  450. ) do
  451. {:ok,
  452. %Response{
  453. status_code: 200,
  454. body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
  455. }}
  456. end
  457. def get(
  458. "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
  459. [Accept: "application/xrd+xml,application/jrd+json"],
  460. follow_redirect: true
  461. ) do
  462. {:ok,
  463. %Response{
  464. status_code: 200,
  465. body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
  466. }}
  467. end
  468. def get(
  469. "https://squeet.me/xrd/?uri=lain@squeet.me",
  470. [Accept: "application/xrd+xml,application/jrd+json"],
  471. follow_redirect: true
  472. ) do
  473. {:ok,
  474. %Response{
  475. status_code: 200,
  476. body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
  477. }}
  478. end
  479. def get("https://mamot.fr/users/Skruyb.atom", _, _) do
  480. {:ok,
  481. %Response{
  482. status_code: 200,
  483. body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
  484. }}
  485. end
  486. def get(
  487. "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
  488. [Accept: "application/atom+xml"],
  489. _
  490. ) do
  491. {:ok,
  492. %Response{
  493. status_code: 200,
  494. body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
  495. }}
  496. end
  497. def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
  498. {:ok,
  499. %Response{
  500. status_code: 200,
  501. body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
  502. }}
  503. end
  504. def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
  505. {:ok,
  506. %Response{
  507. status_code: 200,
  508. body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
  509. }}
  510. end
  511. def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
  512. {:ok,
  513. %Response{
  514. status_code: 200,
  515. body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
  516. }}
  517. end
  518. def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
  519. {:ok,
  520. %Response{
  521. status_code: 200,
  522. body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
  523. }}
  524. end
  525. def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
  526. {:ok,
  527. %Response{
  528. status_code: 200,
  529. body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
  530. }}
  531. end
  532. def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
  533. {:ok,
  534. %Response{
  535. status_code: 200,
  536. body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
  537. }}
  538. end
  539. def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
  540. {:ok,
  541. %Response{
  542. status_code: 200,
  543. body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
  544. }}
  545. end
  546. def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
  547. {:ok,
  548. %Response{
  549. status_code: 200,
  550. body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
  551. }}
  552. end
  553. def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
  554. {:ok,
  555. %Response{
  556. status_code: 200,
  557. body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
  558. }}
  559. end
  560. def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
  561. {:ok,
  562. %Response{
  563. status_code: 200,
  564. body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
  565. }}
  566. end
  567. def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
  568. {:ok,
  569. %Response{
  570. status_code: 200,
  571. body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
  572. }}
  573. end
  574. def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
  575. {:ok,
  576. %Response{
  577. status_code: 200,
  578. body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
  579. }}
  580. end
  581. def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
  582. {:ok,
  583. %Response{
  584. status_code: 200,
  585. body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
  586. }}
  587. end
  588. def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
  589. {:ok,
  590. %Response{
  591. status_code: 200,
  592. body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
  593. }}
  594. end
  595. def get(
  596. "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
  597. [],
  598. follow_redirect: true
  599. ) do
  600. {:ok,
  601. %Response{
  602. status_code: 200,
  603. body:
  604. File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
  605. }}
  606. end
  607. def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
  608. {:ok,
  609. %Response{
  610. status_code: 200,
  611. body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
  612. }}
  613. end
  614. def get(
  615. "https://hubzilla.example.org/channel/kaniini",
  616. [Accept: "application/activity+json"],
  617. _
  618. ) do
  619. {:ok,
  620. %Response{
  621. status_code: 200,
  622. body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
  623. }}
  624. end
  625. def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
  626. {:ok,
  627. %Response{
  628. status_code: 200,
  629. body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
  630. }}
  631. end
  632. def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
  633. {:ok,
  634. %Response{
  635. status_code: 200,
  636. body: File.read!("test/fixtures/httpoison_mock/rye.json")
  637. }}
  638. end
  639. def get(
  640. "https://mst3k.interlinked.me/users/luciferMysticus",
  641. [Accept: "application/activity+json"],
  642. _
  643. ) do
  644. {:ok,
  645. %Response{
  646. status_code: 200,
  647. body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
  648. }}
  649. end
  650. def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
  651. {:ok,
  652. %Response{
  653. status_code: 200,
  654. body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
  655. }}
  656. end
  657. def get(
  658. "http://mastodon.example.org/@admin/99541947525187367",
  659. [Accept: "application/activity+json"],
  660. _
  661. ) do
  662. {:ok,
  663. %Response{
  664. status_code: 200,
  665. body: File.read!("test/fixtures/mastodon-note-object.json")
  666. }}
  667. end
  668. def get(
  669. "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
  670. [Accept: "application/activity+json"],
  671. _
  672. ) do
  673. {:ok,
  674. %Response{
  675. status_code: 200,
  676. body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
  677. }}
  678. end
  679. def get("https://shitposter.club/notice/7369654", _, _) do
  680. {:ok,
  681. %Response{
  682. status_code: 200,
  683. body: File.read!("test/fixtures/httpoison_mock/7369654.html")
  684. }}
  685. end
  686. def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
  687. {:ok,
  688. %Response{
  689. status_code: 200,
  690. body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
  691. }}
  692. end
  693. def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
  694. {:ok,
  695. %Response{
  696. status_code: 200,
  697. body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
  698. }}
  699. end
  700. def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
  701. {:ok,
  702. %Response{
  703. status_code: 200,
  704. body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
  705. }}
  706. end
  707. def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
  708. {:ok,
  709. %Response{
  710. status_code: 200,
  711. body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
  712. }}
  713. end
  714. def get("https://peertube.moe/accounts/7even", _, _) do
  715. {:ok,
  716. %Response{
  717. status_code: 200,
  718. body: File.read!("test/fixtures/httpoison_mock/7even.json")
  719. }}
  720. end
  721. def get(url, body, headers) do
  722. {:error,
  723. "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
  724. inspect(headers)
  725. }"}
  726. end
  727. def post(url, _body, _headers) do
  728. {:error, "Not implemented the mock response for post #{inspect(url)}"}
  729. end
  730. def post(url, _body, _headers, _options) do
  731. {:error, "Not implemented the mock response for post #{inspect(url)}"}
  732. end
  733. end