Use Mox for unit testing

master
Milton Mazzarri 2019-03-19 22:44:05 -05:00
parent d64ecef2f9
commit 69a885a735
No known key found for this signature in database
GPG Key ID: 9F4193F2B5A558FE
32 changed files with 119 additions and 934 deletions

View File

@ -12,7 +12,7 @@ defmodule Hunter.Mixfile do
description: "Elixir client for Mastodon, a GNU social-compatible micro-blogging service",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
elixirc_paths: ["lib"],
deps: deps()
]
end
@ -30,7 +30,8 @@ defmodule Hunter.Mixfile do
{:httpoison, "~> 1.5"},
{:poison, "~> 4.0"},
{:ex_doc, "~> 0.14", only: :dev, runtime: false},
{:dialyxir, "~> 1.0.0-rc.3", only: :dev, runtime: false}
{:dialyxir, "~> 1.0.0-rc.3", only: :dev, runtime: false},
{:mox, "~> 0.5", only: :test}
]
end
@ -53,8 +54,4 @@ defmodule Hunter.Mixfile do
main: "readme"
]
end
# Specifies which paths to compile per environment
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
end

View File

@ -11,6 +11,7 @@
"makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
"mox": {:hex, :mox, "0.5.0", "c519b48407017a85f03407a9a4c4ceb7cc6dec5fe886b2241869fb2f08476f9e", [:mix], [], "hexpm"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"},
"poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm"},

View File

@ -1,17 +0,0 @@
{
"id": 8039,
"username": "milmazz",
"acct": "milmazz",
"display_name": "Milton Mazzarri",
"locked": false,
"created_at": "2017-04-06T17:43:55.325Z",
"followers_count": 4,
"following_count": 4,
"statuses_count": 3,
"note": "",
"url": "https://social.lou.lt/@milmazz",
"avatar": "https://social.lou.lt/avatars/original/missing.png",
"avatar_static": "https://social.lou.lt/avatars/original/missing.png",
"header": "https://social.lou.lt/headers/original/missing.png",
"header_static": "https://social.lou.lt/headers/original/missing.png"
}

View File

@ -1,6 +0,0 @@
{
"url": "https://github.com/milmazz/hunter",
"title": "milmazz/hunter",
"image": "https://social.lou.lt/system/preview_cards/images/000/000/378/original/34700?1491626499",
"description": "hunter - A Elixir client for Mastodon, a GNU Social compatible micro-blogging service"
}

View File

@ -1,5 +0,0 @@
{
"client_id": "1234567890",
"client_secret": "1234567890",
"id": 1234
}

View File

@ -1,40 +0,0 @@
{
"visibility": "public",
"url": "https://social.lou.lt/@FriendlyPootis/442",
"uri": "tag:social.lou.lt,2017-04-03:objectId=442:objectType=Status",
"tags": [],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 4,
"reblogged": false,
"reblog": null,
"mentions": [],
"media_attachments": [],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 442,
"favourites_count": 5,
"favourited": true,
"created_at": "2017-04-03T16:22:04.286Z",
"content": "<p>les gens pensez à migrer d&apos;instance pour en aller sur une moins chargée tant que vous pouvez, plus vous attendrez plus vous aurez la flemme</p>",
"application": {
"id": null,
"client_secret": null,
"client_id": null
},
"account": {
"username": "FriendlyPootis",
"url": "https://social.lou.lt/@FriendlyPootis",
"statuses_count": 253,
"note": "fermé comme un carré, Vladimir Pootin sur YT (<a href=\"https://www.youtube.com/VladimirPootin\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"\">youtube.com/VladimirPootin</span><span class=\"invisible\"></span></a>)",
"locked": false,
"id": 34,
"header": "https://social.lou.lt/system/accounts/headers/000/000/034/original/b009ddb5a8ce41c1.jpg?1491228302",
"following_count": 53,
"followers_count": 62,
"display_name": "FriendlyPootis 🚉",
"created_at": "2017-04-03T13:50:06.485Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/000/034/original/565da0399c2c26cf.jpg?1491228302",
"acct": "FriendlyPootis"
}
}

View File

@ -1,36 +0,0 @@
[
{
"id": 2286,
"username": "marxistvegan",
"acct": "marxistvegan",
"display_name": "stephen 🌹✪",
"locked": false,
"created_at": "2017-04-12T13:21:32.932Z",
"followers_count": 45,
"following_count": 62,
"statuses_count": 65,
"note": "Luxemburgist. Organizer in the labor &amp; social movements. Co-host <a href=\"https://cyberunions.org\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">cyberunions.org</span><span class=\"invisible\"></span></a> podcast, member of <a href=\"https://glocal.coop\" rel=\"nofollow noopener noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">glocal.coop</span><span class=\"invisible\"></span></a>. Pronoun he/him <a href=\"https://soc.ialis.me/tags/antifa\" class=\"mention hashtag\">#<span>AntiFa</span></a> <a href=\"https://soc.ialis.me/tags/marxist\" class=\"mention hashtag\">#<span>marxist</span></a>",
"url": "https://soc.ialis.me/@marxistvegan",
"avatar": "https://pictor.ialis.me/accounts/avatars/000/002/286/original/a7154cd28f490be2.jpeg?1492003901",
"avatar_static": "https://pictor.ialis.me/accounts/avatars/000/002/286/original/a7154cd28f490be2.jpeg?1492003901",
"header": "https://pictor.ialis.me/accounts/headers/000/002/286/original/b0457c9d6168b53e.png?1492080325",
"header_static": "https://pictor.ialis.me/accounts/headers/000/002/286/original/b0457c9d6168b53e.png?1492080325"
},
{
"id": 1,
"username": "href",
"acct": "href",
"display_name": "href",
"locked": false,
"created_at": "2017-04-09T12:19:29.077Z",
"followers_count": 132,
"following_count": 198,
"statuses_count": 418,
"note": "cybermenace &amp; mauvaise influence. <a href=\"https://soc.ialis.me/tags/freebsd\" class=\"mention hashtag\">#<span>freebsd</span></a>, <a href=\"https://soc.ialis.me/tags/erlang\" class=\"mention hashtag\">#<span>erlang</span></a>, <a href=\"https://soc.ialis.me/tags/elixir\" class=\"mention hashtag\">#<span>elixir</span></a>. <a href=\"https://soc.ialis.me/tags/fr\" class=\"mention hashtag\">#<span>fr</span></a> &amp; <a href=\"https://soc.ialis.me/tags/en\" class=\"mention hashtag\">#<span>en</span></a>.\r\n\r\n<a href=\"http://href.rocks\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">http://</span><span class=\"\">href.rocks</span><span class=\"invisible\"></span></a> - <a href=\"https://random.sh\" rel=\"nofollow noopener noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">random.sh</span><span class=\"invisible\"></span></a>\r\n\r\n<a href=\"https://soc.ialis.me\" rel=\"nofollow noopener noopener noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">soc.ialis.me</span><span class=\"invisible\"></span></a> admin",
"url": "https://soc.ialis.me/@href",
"avatar": "https://pictor.ialis.me/accounts/avatars/000/000/001/original/42fe522de966bd8a.jpg?1491741513",
"avatar_static": "https://pictor.ialis.me/accounts/avatars/000/000/001/original/42fe522de966bd8a.jpg?1491741513",
"header": "https://pictor.ialis.me/accounts/headers/000/000/001/original/53b5cb6b4bb97932.jpg?1491745462",
"header_static": "https://pictor.ialis.me/accounts/headers/000/000/001/original/53b5cb6b4bb97932.jpg?1491745462"
}
]

View File

@ -1,38 +0,0 @@
[
{
"visibility": "public",
"url": "https://mstdn.io/users/paperswelove/updates/19905",
"uri": "tag:mstdn.io,2017-04-16:objectId=421573:objectType=Status",
"tags": [],
"spoiler_text": "Distributed Systems Paper",
"sensitive": false,
"reblogs_count": 0,
"reblogged": null,
"reblog": null,
"mentions": [],
"media_attachments": [],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 376262,
"favourites_count": 0,
"favourited": true,
"created_at": "2017-04-16T15:32:24.000Z",
"content": "<p>Impossibility of Distributed Consensus with One Faulty<br>Process - Fischer, Lynch, Paterson</p><p>PDF: <a href=\"https://groups.csail.mit.edu/tds/papers/Lynch/jacm85.pdf\" rel=\"nofollow noopener\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">groups.csail.mit.edu/tds/paper</span><span class=\"invisible\">s/Lynch/jacm85.pdf</span></a></p><p>The consensus problem involves an asynchronous system of processes, some of which may be unreliable. The problem is for the reliable processes to agree on a binary value. In this paper, it is shown that every protocol for this problem has the possibility of nontermination, even with only one faulty process.</p>",
"application": null,
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 20,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 3,
"followers_count": 2,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}
]

View File

@ -1,15 +0,0 @@
{
"acct": "paperswelove@mstdn.io",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"created_at": "2017-04-06T13:44:18.281Z",
"display_name": "Papers We Love",
"followers_count": 1,
"following_count": 0,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"id": 7126,
"locked": false,
"note": "Building Bridges Between Academia and Industry\r\n\r\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\r\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"statuses_count": 1,
"url": "https://mstdn.io/@paperswelove",
"username": "paperswelove"
}

View File

@ -1,70 +0,0 @@
[
{
"id": 14825,
"username": "kadaba",
"acct": "kadaba@lavraievie.social",
"display_name": "Kadaba ✅",
"locked": false,
"created_at": "2017-04-10T15:53:45.161Z",
"followers_count": 1,
"following_count": 2,
"statuses_count": 25,
"note": "¡Cagando...! Digo: ¡¡¡...Cargando...!!! Debugging with Prozac. =JDK= ⠠⠵",
"url": "https://lavraievie.social/@kadaba",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/014/825/original/2acce7800f6d0366.jpeg?1491839628",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/014/825/original/2acce7800f6d0366.jpeg?1491839628",
"header": "https://social.lou.lt/system/accounts/headers/000/014/825/original/missing.png?1491839631",
"header_static": "https://social.lou.lt/system/accounts/headers/000/014/825/original/missing.png?1491839631"
},
{
"id": 7126,
"username": "paperswelove",
"acct": "paperswelove@mstdn.io",
"display_name": "Papers We Love",
"locked": false,
"created_at": "2017-04-06T13:44:18.281Z",
"followers_count": 2,
"following_count": 3,
"statuses_count": 16,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"url": "https://mstdn.io/@paperswelove",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"header_static": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258"
},
{
"id": 8518,
"username": "atmantree",
"acct": "atmantree@mastodon.club",
"display_name": "Carlos Gustavo Ruiz",
"locked": false,
"created_at": "2017-04-06T20:07:57.119Z",
"followers_count": 2,
"following_count": 2,
"statuses_count": 0,
"note": "Programmer, Pythonista, Web Creature, Blogger, C++ and Haskell Fan. Never stop learning, because life never stops teaching.",
"url": "https://mastodon.club/@atmantree",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/008/518/original/7715529d4ceb4554.jpg?1491509276",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/008/518/original/7715529d4ceb4554.jpg?1491509276",
"header": "https://social.lou.lt/system/accounts/headers/000/008/518/original/394f31473de7c64a.png?1491509277",
"header_static": "https://social.lou.lt/system/accounts/headers/000/008/518/original/394f31473de7c64a.png?1491509277"
},
{
"id": 4682,
"username": "pankas87",
"acct": "pankas87",
"display_name": "Leonardo Graterol",
"locked": false,
"created_at": "2017-04-05T21:22:13.280Z",
"followers_count": 18,
"following_count": 20,
"statuses_count": 37,
"note": "I trade developing services for currency. Ruby fan, PHP mercenary, getting mind fucked by Scala. Venezuelan living in Chile\r\n\r\nLanguages: Spanish and English",
"url": "https://social.lou.lt/@pankas87",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/004/682/original/7a5fc3a6f54c833e.jpg?1491428029",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/004/682/original/7a5fc3a6f54c833e.jpg?1491428029",
"header": "https://social.lou.lt/headers/original/missing.png",
"header_static": "https://social.lou.lt/headers/original/missing.png"
}
]

View File

@ -1,70 +0,0 @@
[
{
"id": 7126,
"username": "paperswelove",
"acct": "paperswelove@mstdn.io",
"display_name": "Papers We Love",
"locked": false,
"created_at": "2017-04-06T13:44:18.281Z",
"followers_count": 2,
"following_count": 3,
"statuses_count": 16,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"url": "https://mstdn.io/@paperswelove",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"header_static": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258"
},
{
"id": 8518,
"username": "atmantree",
"acct": "atmantree@mastodon.club",
"display_name": "Carlos Gustavo Ruiz",
"locked": false,
"created_at": "2017-04-06T20:07:57.119Z",
"followers_count": 2,
"following_count": 2,
"statuses_count": 0,
"note": "Programmer, Pythonista, Web Creature, Blogger, C++ and Haskell Fan. Never stop learning, because life never stops teaching.",
"url": "https://mastodon.club/@atmantree",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/008/518/original/7715529d4ceb4554.jpg?1491509276",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/008/518/original/7715529d4ceb4554.jpg?1491509276",
"header": "https://social.lou.lt/system/accounts/headers/000/008/518/original/394f31473de7c64a.png?1491509277",
"header_static": "https://social.lou.lt/system/accounts/headers/000/008/518/original/394f31473de7c64a.png?1491509277"
},
{
"id": 4682,
"username": "pankas87",
"acct": "pankas87",
"display_name": "Leonardo Graterol",
"locked": false,
"created_at": "2017-04-05T21:22:13.280Z",
"followers_count": 18,
"following_count": 20,
"statuses_count": 37,
"note": "I trade developing services for currency. Ruby fan, PHP mercenary, getting mind fucked by Scala. Venezuelan living in Chile\r\n\r\nLanguages: Spanish and English",
"url": "https://social.lou.lt/@pankas87",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/004/682/original/7a5fc3a6f54c833e.jpg?1491428029",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/004/682/original/7a5fc3a6f54c833e.jpg?1491428029",
"header": "https://social.lou.lt/headers/original/missing.png",
"header_static": "https://social.lou.lt/headers/original/missing.png"
},
{
"id": 7899,
"username": "sebasmagri",
"acct": "sebasmagri@mastodon.cloud",
"display_name": "Sebastián Ramírez Magrí",
"locked": false,
"created_at": "2017-04-06T17:07:38.912Z",
"followers_count": 2,
"following_count": 1,
"statuses_count": 7,
"note": "",
"url": "https://mastodon.cloud/@sebasmagri",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/899/original/19b4d8c1e9d4e68a.jpg?1491498458",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/007/899/original/19b4d8c1e9d4e68a.jpg?1491498458",
"header": "https://social.lou.lt/system/accounts/headers/000/007/899/original/missing.png?1491498458",
"header_static": "https://social.lou.lt/system/accounts/headers/000/007/899/original/missing.png?1491498458"
}
]

View File

@ -1,60 +0,0 @@
[
{
"visibility": "public",
"url": "https://mstdn.io/users/paperswelove/updates/9954",
"uri": "tag:mstdn.io,2017-04-10:objectId=171105:objectType=Status",
"tags": [
{
"url": "https://social.lou.lt/tags/paperswelove",
"name": "paperswelove"
},
{
"url": "https://social.lou.lt/tags/compsci",
"name": "compsci"
},
{
"url": "https://social.lou.lt/tags/garbagecollection",
"name": "garbagecollection"
}
],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 0,
"reblogged": null,
"reblog": null,
"mentions": [],
"media_attachments": [
{
"url": "https://social.lou.lt/system/media_attachments/files/000/010/284/original/b0432b95264e141c.png?1491824449",
"type": "image",
"text_url": null,
"remote_url": "https://mstdn.io/system/media_attachments/files/000/009/562/original/b0432b95264e141c.png",
"preview_url": "https://social.lou.lt/system/media_attachments/files/000/010/284/small/b0432b95264e141c.png?1491824449",
"id": 10284
}
],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 186397,
"favourites_count": 0,
"favourited": null,
"created_at": "2017-04-10T11:40:45.000Z",
"content": "<p>One Pass Real-Time Generational Mark-Sweep Garbage Collection - Armstrong, Virding</p><p>Link: <a href=\"http://buff.ly/2pdh7iS\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">buff.ly/2pdh7iS</span><span class=\"invisible\"></span></a> </p><p>In this paper we present a simple scheme for reclaiming data for such language classes with a single pass mark-sweep collector. We also show how the simple scheme can be modified so that the collection can be done in an incremental manner (making it suitable for real-time collection).</p><p><a href=\"https://mstdn.io/tags/garbagecollection\" class=\"mention hashtag\">#<span>garbagecollection</span></a> <a href=\"https://mstdn.io/tags/compsci\" class=\"mention hashtag\">#<span>compsci</span></a> <a href=\"https://mstdn.io/tags/paperswelove\" class=\"mention hashtag\">#<span>paperswelove</span></a></p><p> <a href=\"https://mstdn.io/media/u03CNEJZho1pvTR3q6Y\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">mstdn.io/media/u03CNEJZho1pvTR</span><span class=\"invisible\">3q6Y</span></a></p>",
"application": null,
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 8,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 1,
"followers_count": 1,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}
]

View File

@ -1,60 +0,0 @@
[
{
"visibility": "public",
"url": "https://mstdn.io/users/paperswelove/updates/9954",
"uri": "tag:mstdn.io,2017-04-10:objectId=171105:objectType=Status",
"tags": [
{
"url": "https://social.lou.lt/tags/paperswelove",
"name": "paperswelove"
},
{
"url": "https://social.lou.lt/tags/compsci",
"name": "compsci"
},
{
"url": "https://social.lou.lt/tags/garbagecollection",
"name": "garbagecollection"
}
],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 0,
"reblogged": null,
"reblog": null,
"mentions": [],
"media_attachments": [
{
"url": "https://social.lou.lt/system/media_attachments/files/000/010/284/original/b0432b95264e141c.png?1491824449",
"type": "image",
"text_url": null,
"remote_url": "https://mstdn.io/system/media_attachments/files/000/009/562/original/b0432b95264e141c.png",
"preview_url": "https://social.lou.lt/system/media_attachments/files/000/010/284/small/b0432b95264e141c.png?1491824449",
"id": 10284
}
],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 186397,
"favourites_count": 0,
"favourited": null,
"created_at": "2017-04-10T11:40:45.000Z",
"content": "<p>One Pass Real-Time Generational Mark-Sweep Garbage Collection - Armstrong, Virding</p><p>Link: <a href=\"http://buff.ly/2pdh7iS\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">buff.ly/2pdh7iS</span><span class=\"invisible\"></span></a> </p><p>In this paper we present a simple scheme for reclaiming data for such language classes with a single pass mark-sweep collector. We also show how the simple scheme can be modified so that the collection can be done in an incremental manner (making it suitable for real-time collection).</p><p><a href=\"https://mstdn.io/tags/garbagecollection\" class=\"mention hashtag\">#<span>garbagecollection</span></a> <a href=\"https://mstdn.io/tags/compsci\" class=\"mention hashtag\">#<span>compsci</span></a> <a href=\"https://mstdn.io/tags/paperswelove\" class=\"mention hashtag\">#<span>paperswelove</span></a></p><p> <a href=\"https://mstdn.io/media/u03CNEJZho1pvTR3q6Y\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">mstdn.io/media/u03CNEJZho1pvTR</span><span class=\"invisible\">3q6Y</span></a></p>",
"application": null,
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 8,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 1,
"followers_count": 1,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}
]

View File

@ -1,6 +0,0 @@
{
"uri": "social.lou.lt",
"title": "Loultstodon",
"email": "maxime+mastodon@melinon.fr",
"description": "Mostly French instance - <a href=\"/about/more#rules\">Read full description</a> for rules."
}

View File

@ -1,7 +0,0 @@
{
"requested": false,
"muting": true,
"following": true,
"followed_by": false,
"blocking": false
}

View File

@ -1,21 +0,0 @@
{
"type": "follow",
"status": null,
"id": 17476,
"created_at": "2017-04-08T12:15:53.467Z",
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 8,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 1,
"followers_count": 1,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}

View File

@ -1,23 +0,0 @@
[
{
"type": "follow",
"status": null,
"id": 17476,
"created_at": "2017-04-08T12:15:53.467Z",
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 8,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 1,
"followers_count": 1,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}
]

View File

@ -1,60 +0,0 @@
[
{
"visibility": "public",
"url": "https://mstdn.io/users/paperswelove/updates/9954",
"uri": "tag:mstdn.io,2017-04-10:objectId=171105:objectType=Status",
"tags": [
{
"url": "https://social.lou.lt/tags/paperswelove",
"name": "paperswelove"
},
{
"url": "https://social.lou.lt/tags/compsci",
"name": "compsci"
},
{
"url": "https://social.lou.lt/tags/garbagecollection",
"name": "garbagecollection"
}
],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 0,
"reblogged": null,
"reblog": null,
"mentions": [],
"media_attachments": [
{
"url": "https://social.lou.lt/system/media_attachments/files/000/010/284/original/b0432b95264e141c.png?1491824449",
"type": "image",
"text_url": null,
"remote_url": "https://mstdn.io/system/media_attachments/files/000/009/562/original/b0432b95264e141c.png",
"preview_url": "https://social.lou.lt/system/media_attachments/files/000/010/284/small/b0432b95264e141c.png?1491824449",
"id": 10284
}
],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 186397,
"favourites_count": 0,
"favourited": null,
"created_at": "2017-04-10T11:40:45.000Z",
"content": "<p>One Pass Real-Time Generational Mark-Sweep Garbage Collection - Armstrong, Virding</p><p>Link: <a href=\"http://buff.ly/2pdh7iS\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">buff.ly/2pdh7iS</span><span class=\"invisible\"></span></a> </p><p>In this paper we present a simple scheme for reclaiming data for such language classes with a single pass mark-sweep collector. We also show how the simple scheme can be modified so that the collection can be done in an incremental manner (making it suitable for real-time collection).</p><p><a href=\"https://mstdn.io/tags/garbagecollection\" class=\"mention hashtag\">#<span>garbagecollection</span></a> <a href=\"https://mstdn.io/tags/compsci\" class=\"mention hashtag\">#<span>compsci</span></a> <a href=\"https://mstdn.io/tags/paperswelove\" class=\"mention hashtag\">#<span>paperswelove</span></a></p><p> <a href=\"https://mstdn.io/media/u03CNEJZho1pvTR3q6Y\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">mstdn.io/media/u03CNEJZho1pvTR</span><span class=\"invisible\">3q6Y</span></a></p>",
"application": null,
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 8,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 1,
"followers_count": 1,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}
]

View File

@ -1,36 +0,0 @@
[
{
"id": 970,
"username": "maliciarogue",
"acct": "maliciarogue@mastodon.social",
"display_name": "R ✅",
"locked": false,
"created_at": "2017-04-10T14:30:57.949Z",
"followers_count": 3,
"following_count": 2,
"statuses_count": 156,
"note": "I troll, therefore I am. Writer; OSINT &amp; sec analyst; I do risk &amp; crisis mngmnt so u don't have to.Polylingual bookworm. I toot 4 chocolate /!\\Parental advisory",
"url": "https://mastodon.social/@maliciarogue",
"avatar": "https://pictor.ialis.me/accounts/avatars/000/000/970/original/d5a601a0133d75c1.jpg?1491834658",
"avatar_static": "https://pictor.ialis.me/accounts/avatars/000/000/970/original/d5a601a0133d75c1.jpg?1491834658",
"header": "/headers/original/missing.png",
"header_static": "/headers/original/missing.png"
},
{
"id": 2495,
"username": "hecate",
"acct": "hecate",
"display_name": "Hecatée Irssiainen",
"locked": false,
"created_at": "2017-04-12T20:05:42.369Z",
"followers_count": 5,
"following_count": 6,
"statuses_count": 9,
"note": "Cyber-postrock technoqueer. I go by she/her, and it&apos;s usually with your mum.",
"url": "https://soc.ialis.me/@hecate",
"avatar": "https://pictor.ialis.me/accounts/avatars/000/002/495/original/7c78b503266e4bdf.png?1492027924",
"avatar_static": "https://pictor.ialis.me/accounts/avatars/000/002/495/original/7c78b503266e4bdf.png?1492027924",
"header": "https://pictor.ialis.me/accounts/headers/000/002/495/original/a1f76633a274cb61.jpg?1492027924",
"header_static": "https://pictor.ialis.me/accounts/headers/000/002/495/original/a1f76633a274cb61.jpg?1492027924"
}
]

View File

@ -1,38 +0,0 @@
{
"visibility": "public",
"url": "https://mstdn.io/users/paperswelove/updates/19905",
"uri": "tag:mstdn.io,2017-04-16:objectId=421573:objectType=Status",
"tags": [],
"spoiler_text": "Distributed Systems Paper",
"sensitive": false,
"reblogs_count": 0,
"reblogged": false,
"reblog": null,
"mentions": [],
"media_attachments": [],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 376262,
"favourites_count": 0,
"favourited": true,
"created_at": "2017-04-16T15:32:24.000Z",
"content": "<p>Impossibility of Distributed Consensus with One Faulty<br>Process - Fischer, Lynch, Paterson</p><p>PDF: <a href=\"https://groups.csail.mit.edu/tds/papers/Lynch/jacm85.pdf\" rel=\"nofollow noopener\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">groups.csail.mit.edu/tds/paper</span><span class=\"invisible\">s/Lynch/jacm85.pdf</span></a></p><p>The consensus problem involves an asynchronous system of processes, some of which may be unreliable. The problem is for the reliable processes to agree on a binary value. In this paper, it is shown that every protocol for this problem has the possibility of nontermination, even with only one faulty process.</p>",
"application": null,
"account": {
"username": "paperswelove",
"url": "https://mstdn.io/@paperswelove",
"statuses_count": 20,
"note": "Building Bridges Between Academia and Industry\n\n<a href=\"http://paperswelove.org\" rel=\"nofollow noopener\"><span class=\"invisible\">http://</span><span class=\"\">paperswelove.org</span><span class=\"invisible\"></span></a>\n<a href=\"http://pwlconf.org\" rel=\"nofollow noopener noopener\"><span class=\"invisible\">http://</span><span class=\"\">pwlconf.org</span><span class=\"invisible\"></span></a>",
"locked": false,
"id": 7126,
"header_static": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"header": "https://social.lou.lt/system/accounts/headers/000/007/126/original/missing.png?1491486258",
"following_count": 3,
"followers_count": 2,
"display_name": "Papers We Love",
"created_at": "2017-04-06T13:44:18.281Z",
"avatar_static": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/007/126/original/60ecc8225809c008.png?1491486258",
"acct": "paperswelove@mstdn.io"
}
}

View File

@ -1,134 +0,0 @@
[
{
"visibility": "public",
"url": "https://social.lou.lt/@milmazz/212703",
"uri": "tag:social.lou.lt,2017-04-11:objectId=212703:objectType=Status",
"tags": [],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 1,
"reblogged": null,
"reblog": null,
"mentions": [],
"media_attachments": [],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 212703,
"favourites_count": 1,
"favourited": null,
"created_at": "2017-04-11T04:55:55.778Z",
"content": "<p>New release: hunter (0.3.0): Elixir client for Mastodon, a GNU social-compatible micro-blogging service</p><p><a href=\"https://hex.pm/packages/hunter\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">hex.pm/packages/hunter</span><span class=\"invisible\"></span></a></p>",
"application": {
"id": null,
"client_secret": null,
"client_id": null
},
"account": {
"username": "milmazz",
"url": "https://social.lou.lt/@milmazz",
"statuses_count": 3,
"note": "",
"locked": false,
"id": 8039,
"header": "https://social.lou.lt/headers/original/missing.png",
"following_count": 4,
"followers_count": 4,
"display_name": "Milton Mazzarri",
"created_at": "2017-04-06T17:43:55.325Z",
"avatar": "https://social.lou.lt/avatars/original/missing.png",
"acct": "milmazz"
}
},
{
"visibility": "public",
"url": "https://social.lou.lt/@milmazz/118635",
"uri": "tag:social.lou.lt,2017-04-08:objectId=118635:objectType=Status",
"tags": [
{
"url": "https://social.lou.lt/tags/myelixirstatus",
"name": "myelixirstatus"
}
],
"spoiler_text": "",
"sensitive": null,
"reblogs_count": 0,
"reblogged": null,
"reblog": null,
"mentions": [],
"media_attachments": [],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 118635,
"favourites_count": 1,
"favourited": null,
"created_at": "2017-04-08T04:41:38.643Z",
"content": "<p>Hunter is a Elixir client for Mastodon: <a href=\"https://github.com/milmazz/hunter\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">github.com/milmazz/hunter</span><span class=\"invisible\"></span></a> <a href=\"https://social.lou.lt/tags/myelixirstatus\" class=\"mention hashtag\">#<span>myelixirstatus</span></a></p>",
"application": {
"id": null,
"client_secret": null,
"client_id": null
},
"account": {
"username": "milmazz",
"url": "https://social.lou.lt/@milmazz",
"statuses_count": 3,
"note": "",
"locked": false,
"id": 8039,
"header": "https://social.lou.lt/headers/original/missing.png",
"following_count": 4,
"followers_count": 4,
"display_name": "Milton Mazzarri",
"created_at": "2017-04-06T17:43:55.325Z",
"avatar": "https://social.lou.lt/avatars/original/missing.png",
"acct": "milmazz"
}
},
{
"visibility": "public",
"url": "https://social.lou.lt/@milmazz/59144",
"uri": "tag:social.lou.lt,2017-04-06:objectId=59144:objectType=Status",
"tags": [],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 0,
"reblogged": null,
"reblog": null,
"mentions": [
{
"username": "Shutsumon",
"url": "http://tootplanet.space/@Shutsumon",
"id": 7742,
"acct": "Shutsumon@tootplanet.space"
}
],
"media_attachments": [],
"in_reply_to_id": 59042,
"in_reply_to_account_id": 7742,
"id": 59144,
"favourites_count": 0,
"favourited": null,
"created_at": "2017-04-06T18:28:59.392Z",
"content": "<p><span class=\"h-card\"><a href=\"http://tootplanet.space/@Shutsumon\" class=\"u-url mention\">@<span>Shutsumon</span></a></span> You should read &quot;How to design programs&quot; book <a href=\"http://htdp.org\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">http://</span><span class=\"\">htdp.org</span><span class=\"invisible\"></span></a></p>",
"application": {
"id": null,
"client_secret": null,
"client_id": null
},
"account": {
"username": "milmazz",
"url": "https://social.lou.lt/@milmazz",
"statuses_count": 3,
"note": "",
"locked": false,
"id": 8039,
"header": "https://social.lou.lt/headers/original/missing.png",
"following_count": 4,
"followers_count": 4,
"display_name": "Milton Mazzarri",
"created_at": "2017-04-06T17:43:55.325Z",
"avatar": "https://social.lou.lt/avatars/original/missing.png",
"acct": "milmazz"
}
}
]

View File

@ -1,40 +0,0 @@
{
"visibility": "public",
"url": "https://social.lou.lt/@FriendlyPootis/442",
"uri": "tag:social.lou.lt,2017-04-03:objectId=442:objectType=Status",
"tags": [],
"spoiler_text": "",
"sensitive": false,
"reblogs_count": 4,
"reblogged": false,
"reblog": null,
"mentions": [],
"media_attachments": [],
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"id": 442,
"favourites_count": 5,
"favourited": true,
"created_at": "2017-04-03T16:22:04.286Z",
"content": "<p>les gens pensez à migrer d&apos;instance pour en aller sur une moins chargée tant que vous pouvez, plus vous attendrez plus vous aurez la flemme</p>",
"application": {
"id": null,
"client_secret": null,
"client_id": null
},
"account": {
"username": "FriendlyPootis",
"url": "https://social.lou.lt/@FriendlyPootis",
"statuses_count": 253,
"note": "fermé comme un carré, Vladimir Pootin sur YT (<a href=\"https://www.youtube.com/VladimirPootin\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"\">youtube.com/VladimirPootin</span><span class=\"invisible\"></span></a>)",
"locked": false,
"id": 34,
"header": "https://social.lou.lt/system/accounts/headers/000/000/034/original/b009ddb5a8ce41c1.jpg?1491228302",
"following_count": 53,
"followers_count": 62,
"display_name": "FriendlyPootis 🚉",
"created_at": "2017-04-03T13:50:06.485Z",
"avatar": "https://social.lou.lt/system/accounts/avatars/000/000/034/original/565da0399c2c26cf.jpg?1491228302",
"acct": "FriendlyPootis"
}
}

View File

@ -1,7 +0,0 @@
{
"requested": false,
"muting": false,
"following": true,
"followed_by": false,
"blocking": false
}

View File

@ -1,17 +0,0 @@
{
"id": 8039,
"username": "milmazz",
"acct": "milmazz",
"display_name": "Milton Mazzarri",
"locked": false,
"created_at": "2017-04-06T17:43:55.325Z",
"followers_count": 4,
"following_count": 4,
"statuses_count": 3,
"note": "",
"url": "https://social.lou.lt/@milmazz",
"avatar": "https://social.lou.lt/avatars/original/missing.png",
"avatar_static": "https://social.lou.lt/avatars/original/missing.png",
"header": "https://social.lou.lt/headers/original/missing.png",
"header_static": "https://social.lou.lt/headers/original/missing.png"
}

View File

@ -1,33 +1,52 @@
defmodule Hunter.AccountTest do
use ExUnit.Case, async: true
doctest Hunter.Account
import Mox
alias Hunter.Account
setup do
[conn: Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")]
@conn Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")
setup :verify_on_exit!
test "verify credentials" do
expect(Hunter.ApiMock, :verify_credentials, fn %Hunter.Client{} ->
%Account{username: "milmazz"}
end)
assert %Account{username: "milmazz"} = Account.verify_credentials(@conn)
end
test "verify credentials", %{conn: conn} do
assert %Account{username: "milmazz"} = Account.verify_credentials(conn)
test "returns an account" do
expect(Hunter.ApiMock, :account, fn %Hunter.Client{}, _id ->
%Account{username: "milmazz"}
end)
assert %Account{username: "milmazz"} = Account.account(@conn, 8039)
end
test "returns an account", %{conn: conn} do
assert %Account{username: "milmazz"} = Account.account(conn, 8039)
test "returns a collection of followers accounts" do
expect(Hunter.ApiMock, :followers, fn %Hunter.Client{}, _id, _opts ->
[%Account{username: "kadaba"}]
end)
assert [%Account{username: "kadaba"} | _] = Account.followers(@conn, 8039)
end
test "returns a collection of followers accounts", %{conn: conn} do
collection = Account.followers(conn, 8039)
assert %Account{username: "kadaba"} = List.first(collection)
test "returns a collection of following accounts" do
expect(Hunter.ApiMock, :following, fn %Hunter.Client{}, _id, _opts ->
[%Account{username: "paperswelove"}]
end)
assert [%Account{username: "paperswelove"} | _] = Account.following(@conn, 8039)
end
test "returns a collection of following accounts", %{conn: conn} do
collection = Account.following(conn, 8039)
assert %Account{username: "paperswelove"} = List.first(collection)
end
test "following a remote user" do
expect(Hunter.ApiMock, :follow_by_uri, fn %Hunter.Client{}, _id ->
%Account{username: "paperswelove"}
end)
test "following a remote user", %{conn: conn} do
assert %Account{username: "paperswelove"} =
Account.follow_by_uri(conn, "paperswelove@mstdn.io")
Account.follow_by_uri(@conn, "paperswelove@mstdn.io")
end
end

View File

@ -1,4 +1,25 @@
defmodule Hunter.ApplicationTest do
use ExUnit.Case, async: true
doctest Hunter.Application
import Mox
alias Hunter.Application
setup :verify_on_exit!
test "should allow to create an app" do
expect(Hunter.ApiMock, :create_app, fn _client, _redirect, _scopes, _website, _opts ->
%Application{client_id: "1234567890", client_secret: "1234567890", id: 1234}
end)
assert %Application{client_id: "1234567890", client_secret: "1234567890", id: 1234} ==
Application.create_app(
"hunter",
"urn:ietf:wg:oauth:2.0:oob",
["read", "write", "follow"],
nil,
save?: false,
api_base_url: "https://example.com"
)
end
end

View File

@ -1,14 +1,18 @@
defmodule Hunter.CardTest do
use ExUnit.Case, async: true
doctest Hunter.Card
import Mox
alias Hunter.Card
setup do
[conn: Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")]
end
setup :verify_on_exit!
test "verify a card associated with a status", %{conn: conn} do
test "verify a card associated with a status" do
expect(Hunter.ApiMock, :card_by_status, fn _conn, _id ->
%Card{title: "milmazz/hunter"}
end)
conn = Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")
assert %Card{title: "milmazz/hunter"} = Card.card_by_status(conn, 118_635)
end
end

View File

@ -1,14 +1,18 @@
defmodule Hunter.InstanceTest do
use ExUnit.Case, async: true
doctest Hunter.Instance
import Mox
alias Hunter.Instance
setup do
[conn: Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")]
end
setup :verify_on_exit!
test "verify instance information", %{conn: conn} do
test "verify instance information" do
expect(Hunter.ApiMock, :instance_info, fn _conn ->
%Instance{uri: "social.lou.lt"}
end)
conn = Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")
assert %Instance{uri: "social.lou.lt"} = Instance.instance_info(conn)
end
end

View File

@ -1,22 +1,31 @@
defmodule Hunter.NotificationTest do
use ExUnit.Case, async: true
doctest Hunter.Notification
alias Hunter.Notification
import Mox
setup do
[conn: Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")]
alias Hunter.{Account, Notification}
@conn Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")
setup :verify_on_exit!
test "fetch user's notifications" do
expect(Hunter.ApiMock, :notifications, fn _conn, _opts ->
[%Notification{account: %Account{username: "paperswelove"}, type: "follow"}]
end)
[notification | _] = Notification.notifications(@conn)
assert "paperswelove" == notification.account.username
assert "follow" == notification.type
end
test "fetch user's notifications", %{conn: conn} do
notifications = conn |> Notification.notifications() |> List.first()
assert "paperswelove" == notifications.account["username"]
assert "follow" == notifications.type
end
test "fetch a single notification" do
expect(Hunter.ApiMock, :notification, fn _conn, _id ->
%Notification{account: %Account{username: "paperswelove"}, type: "follow"}
end)
test "fetch a single notification", %{conn: conn} do
notification = Notification.notification(conn, 17_476)
assert "paperswelove" == notification.account["username"]
notification = Notification.notification(@conn, 17_476)
assert "paperswelove" == notification.account.username
assert "follow" == notification.type
end
end

View File

@ -1,20 +1,27 @@
defmodule Hunter.StatusTest do
use ExUnit.Case, async: true
doctest Hunter.Status
import Mox
alias Hunter.Status
setup do
[conn: Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")]
@conn Hunter.Client.new(base_url: "https://example.com", bearer_token: "123456")
setup :verify_on_exit!
test "home timeline should return a collection of statuses" do
expect(Hunter.ApiMock, :home_timeline, fn _conn, _opts ->
[%Hunter.Status{}]
end)
assert [timeline | []] = Status.home_timeline(@conn, limit: 1)
end
test "home timeline should return a collection of statuses", %{conn: conn} do
timeline = Status.home_timeline(conn, limit: 1)
assert Enum.count(timeline) == 1
end
test "public time should return a collection of statuses" do
expect(Hunter.ApiMock, :public_timeline, fn _conn, _opts ->
[%Hunter.Status{}]
end)
test "public time should return a collection of statuses", %{conn: conn} do
timeline = Status.public_timeline(conn, limit: 1, local: true)
assert Enum.count(timeline) == 1
assert [timeline | []] = Status.public_timeline(@conn, limit: 1, local: true)
end
end

View File

@ -1,72 +0,0 @@
defmodule Hunter.Api.InMemory do
@moduledoc """
In-Memory Client (for testing purposes)
"""
@behaviour Hunter.Api
[
%{name: :account, arity: 2, as: %Hunter.Account{}},
%{name: :block, arity: 2, as: %Hunter.Relationship{}},
%{name: :blocks, arity: 2, as: [%Hunter.Account{}]},
%{name: :card_by_status, arity: 2, as: %Hunter.Card{}},
%{name: :clear_notifications, arity: 1, as: %{}},
%{name: :create_app, arity: 5, as: %Hunter.Application{}},
%{name: :create_status, arity: 3, as: %Hunter.Status{}},
%{name: :favourite, arity: 2, as: %Hunter.Status{}},
%{name: :favourited_by, arity: 3, as: [%Hunter.Account{}]},
%{name: :favourites, arity: 2, as: [%Hunter.Status{}]},
%{name: :follow, arity: 2, as: %Hunter.Relationship{}},
%{name: :follow_by_uri, arity: 2, as: %Hunter.Account{}},
%{name: :follow_requests, arity: 2, as: [%Hunter.Account{}]},
%{name: :followers, arity: 3, as: [%Hunter.Account{}]},
%{name: :following, arity: 3, as: [%Hunter.Account{}]},
%{name: :hashtag_timeline, arity: 3, as: [%Hunter.Status{}]},
%{name: :home_timeline, arity: 2, as: [%Hunter.Status{}]},
%{name: :instance_info, arity: 1, as: %Hunter.Instance{}},
%{name: :log_in, arity: 4, as: %Hunter.Client{}},
%{name: :mute, arity: 2, as: %Hunter.Relationship{}},
%{name: :mutes, arity: 2, as: [%Hunter.Account{}]},
%{name: :notification, arity: 2, as: %Hunter.Notification{}},
%{name: :notifications, arity: 2, as: [%Hunter.Notification{}]},
%{name: :public_timeline, arity: 2, as: [%Hunter.Status{}]},
%{name: :reblog, arity: 2, as: %Hunter.Status{}},
%{name: :reblogged_by, arity: 3, as: [%Hunter.Account{}]},
%{name: :relationships, arity: 2, as: [%Hunter.Relationship{}]},
%{name: :report, arity: 4, as: %Hunter.Report{}},
%{name: :reports, arity: 1, as: [%Hunter.Report{}]},
%{name: :search, arity: 3, as: %Hunter.Result{}},
%{name: :search_account, arity: 2, as: [%Hunter.Account{}]},
%{name: :status, arity: 2, as: %Hunter.Status{}},
%{name: :status_context, arity: 2, as: %Hunter.Context{}},
%{name: :statuses, arity: 3, as: [%Hunter.Status{}]},
%{name: :unblock, arity: 2, as: %Hunter.Relationship{}},
%{name: :unfavourite, arity: 2, as: %Hunter.Status{}},
%{name: :unfollow, arity: 2, as: %Hunter.Relationship{}},
%{name: :unmute, arity: 2, as: %Hunter.Relationship{}},
%{name: :unreblog, arity: 2, as: %Hunter.Status{}},
%{name: :update_credentials, arity: 2, as: %Hunter.Account{}},
%{name: :upload_media, arity: 3, as: %Hunter.Attachment{}},
%{name: :verify_credentials, arity: 1, as: %Hunter.Account{}}
]
|> Enum.map(fn %{name: name, arity: arity, as: as} ->
params = for _ <- 1..arity, do: {:_, [], nil}
as = Macro.escape(as)
def unquote(name)(unquote_splicing(params)) do
file = to_string(unquote(name))
"../fixtures/#{file}.json"
|> Path.expand(__DIR__)
|> File.read!()
|> Poison.decode!(as: unquote(as))
end
end)
def destroy_status(_, _), do: true
def follow_request_action(_, _, _), do: true
def blocked_domains(_, _), do: ["example.com"]
def block_domain(_, _), do: true
def unblock_domain(_, _), do: true
def clear_notification(_, _), do: true
end

View File

@ -1,2 +1,3 @@
ExUnit.start()
Application.put_env(:hunter, :hunter_api, Hunter.Api.InMemory)
Mox.defmock(Hunter.ApiMock, for: Hunter.Api)
Application.put_env(:hunter, :hunter_api, Hunter.ApiMock)