Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conform to Refile Ruby gem #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/exfile/phoenix/helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule Exfile.Phoenix.Helpers do

path = path ++ [file.id, filename]

"/attachments/" <> (Enum.join(path, "/") |> Token.build_path)
"/attachments/" <> (("/" <> Enum.join(path, "/")) |> Token.build_path)
end

@doc """
Expand Down
2 changes: 1 addition & 1 deletion lib/exfile/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Exfile.Router do

defp authenticate(%{path_info: path_info} = conn) do
[token | rest] = path_info
request_path = rest |> Enum.join("/")
request_path = "/" <> Enum.join(rest, "/")
if Exfile.Token.verify_token(request_path, token) do
conn
else
Expand Down
6 changes: 3 additions & 3 deletions lib/exfile/token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Exfile.Token do

@spec verify_token(Path.t, String.t) :: boolean
def verify_token(path, token) do
case Base.url_decode64(token) do
case Base.decode16(token, case: :lower) do
{:ok, hmac} ->
hmac == do_generate_token(path)
:error ->
Expand All @@ -17,8 +17,8 @@ defmodule Exfile.Token do

@spec generate_token(Path.t) :: String.t
def generate_token(path),
do: do_generate_token(path) |> Base.url_encode64
do: do_generate_token(path) |> Base.encode16(case: :lower)

defp do_generate_token(path),
do: :crypto.hmac(:sha256, Exfile.Config.secret, path)
do: :crypto.hmac(:sha, Exfile.Config.secret, path)
end
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ defmodule Exfile.Mixfile do
defp deps do
[
{:plug, "~> 1.0"},
{:ecto, "~> 1.0 or ~> 2.0", optional: true},
{:phoenix, "~> 1.1 or ~> 1.3.0-rc", optional: true},
{:ecto_sql, "~> 3.0", optional: true},
{:phoenix, "~> 1.1", optional: true},
{:phoenix_html, "~> 2.3", optional: true},
{:poison, "~> 1.5 or ~> 2.0 or ~> 3.1", optional: true},
{:poison, "~> 3.0", optional: true},
{:timex, "~> 2.0", only: [:dev, :test]},
{:postgrex, "~> 0.11", only: [:dev, :test]},
{:earmark, "~> 1.1", only: :dev},
Expand Down
25 changes: 14 additions & 11 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
%{"certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [:rebar3], [], "hexpm"},
%{
"certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [:rebar3], [], "hexpm"},
"combine": {:hex, :combine, "0.9.6", "8d1034a127d4cbf6924c8a5010d3534d958085575fa4d9b878f200d79ac78335", [:mix], [], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
"db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
"decimal": {:hex, :decimal, "1.4.0", "fac965ce71a46aab53d3a6ce45662806bdd708a4a95a65cde8a12eb0124a1333", [:mix], [], "hexpm"},
"db_connection": {:hex, :db_connection, "2.1.0", "122e2f62c4906bf2e49554f1e64db5030c19229aa40935f33088e7d543aa79d0", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"},
"decimal": {:hex, :decimal, "1.7.0", "30d6b52c88541f9a66637359ddf85016df9eb266170d53105f02e4a67e00c5aa", [:mix], [], "hexpm"},
"earmark": {:hex, :earmark, "1.2.2", "f718159d6b65068e8daeef709ccddae5f7fdc770707d82e7d126f584cd925b74", [:mix], [], "hexpm"},
"ecto": {:hex, :ecto, "2.1.4", "d1ba932813ec0e0d9db481ef2c17777f1cefb11fc90fa7c142ff354972dfba7e", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
"ecto": {:hex, :ecto, "3.1.5", "07dfe89630857ea1a90fd5575c41b974696dae27071ac91bcbb7b769a15b66db", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.16.2", "3b3e210ebcd85a7c76b4e73f85c5640c011d2a0b2f06dcdf5acdb2ae904e5084", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"gettext": {:hex, :gettext, "0.13.1", "5e0daf4e7636d771c4c71ad5f3f53ba09a9ae5c250e1ab9c42ba9edccc476263", [:mix], [], "hexpm"},
"hackney": {:hex, :hackney, "1.8.6", "21a725db3569b3fb11a6af17d5c5f654052ce9624219f1317e8639183de4a423", [:rebar3], [{:certifi, "1.2.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.0.2", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "5.0.2", "ac203208ada855d95dc591a764b6e87259cb0e2a364218f215ad662daa8cd6b4", [:rebar3], [{:unicode_util_compat, "0.2.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"},
"mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], [], "hexpm"},
"mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
"phoenix": {:hex, :phoenix, "1.3.0-rc.2", "53104ada25ba85fe160268c0dc826fe038bc074293730b4522fb9aca28d8aa13", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.2 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix": {:hex, :phoenix, "1.4.6", "8535f4a01291f0fbc2c30c78c4ca6a2eacc148db5178ad76e8b2fc976c590115", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"},
"phoenix_html": {:hex, :phoenix_html, "2.9.3", "1b5a2122cbf743aa242f54dced8a4f1cc778b8bd304f4b4c0043a6250c58e258", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], [], "hexpm"},
"plug": {:hex, :plug, "1.3.5", "7503bfcd7091df2a9761ef8cecea666d1f2cc454cbbaf0afa0b6e259203b7031", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.2", "496c303bdf1b2e98a9d26e89af5bba3ab487ba3a3735f74bf1f4064d2a845a3e", [:mix], [], "hexpm"},
"plug": {:hex, :plug, "1.8.2", "0bcce1daa420f189a6491f3940cc77ea7fb1919761175c9c3b59800d897440fc", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm"},
"plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"},
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm"},
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], [], "hexpm"},
"postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"},
"postgrex": {:hex, :postgrex, "0.14.3", "5754dee2fdf6e9e508cbf49ab138df964278700b764177e8f3871e658b345a1e", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
"timex": {:hex, :timex, "2.2.1", "0d69012a7fd69f4cbdaa00cc5f2a5f30f1bed56072fb362ed4bddf60db343022", [:mix], [{:combine, "~> 0.7", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"},
"tzdata": {:hex, :tzdata, "0.5.12", "1c17b68692c6ba5b6ab15db3d64cc8baa0f182043d5ae9d4b6d35d70af76f67b", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.2.0", "dbbccf6781821b1c0701845eaf966c9b6d83d7c3bfc65ca2b78b88b8678bfa35", [:rebar3], [], "hexpm"}}
"unicode_util_compat": {:hex, :unicode_util_compat, "0.2.0", "dbbccf6781821b1c0701845eaf966c9b6d83d7c3bfc65ca2b78b88b8678bfa35", [:rebar3], [], "hexpm"},
}
44 changes: 22 additions & 22 deletions test/exfile/phoenix/helpers_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,68 +26,68 @@ defmodule Exfile.Phoenix.HelpersTest do
alias Exfile.Phoenix.Helpers, as: H

test "path to original file" do
assert H.exfile_path(a_file()) == build_path("store/file_id/file")
assert H.exfile_path(a_file()) == build_path("/store/file_id/file")
end

test "path to file with format" do
assert H.exfile_path(a_file(), format: "jpeg") == build_path("store/file_id/file.jpeg")
assert H.exfile_path(a_file(), format: "png") == build_path("store/file_id/file.png")
assert H.exfile_path(a_file(), format: "jpeg") == build_path("/store/file_id/file.jpeg")
assert H.exfile_path(a_file(), format: "png") == build_path("/store/file_id/file.png")
end

test "path to file with filename" do
assert H.exfile_path(a_file(), filename: "hello-there.jpg") == build_path("store/file_id/hello-there.jpg")
assert H.exfile_path(a_file(), filename: "hello-there.png", format: "png") == build_path("store/file_id/hello-there.png")
assert H.exfile_path(a_file(), filename: "hello-there.png", format: "jpg") == build_path("store/file_id/hello-there.png")
assert H.exfile_path(a_file(), filename: "hello-there.jpg") == build_path("/store/file_id/hello-there.jpg")
assert H.exfile_path(a_file(), filename: "hello-there.png", format: "png") == build_path("/store/file_id/hello-there.png")
assert H.exfile_path(a_file(), filename: "hello-there.png", format: "jpg") == build_path("/store/file_id/hello-there.png")
end

test "path to file with processor" do
assert H.exfile_path(a_file(), processor: "dummy-processor") == build_path("store/dummy-processor/file_id/file")
assert H.exfile_path(a_file(), processor: "dummy-processor", format: "jpeg") == build_path("store/dummy-processor/file_id/file.jpeg")
assert H.exfile_path(a_file(), processor: "dummy-processor") == build_path("/store/dummy-processor/file_id/file")
assert H.exfile_path(a_file(), processor: "dummy-processor", format: "jpeg") == build_path("/store/dummy-processor/file_id/file.jpeg")
end

test "path to file with processor and arguments" do
assert H.exfile_path(a_file(), processor: "dummy-processor", processor_args: ["1000", "1500"]) == build_path("store/dummy-processor/1000/1500/file_id/file")
assert H.exfile_path(a_file(), processor: "dummy-processor", processor_args: ["1000", "1500"], format: "jpeg") == build_path("store/dummy-processor/1000/1500/file_id/file.jpeg")
assert H.exfile_path(a_file(), processor: "dummy-processor", processor_args: ["1000", "1500"]) == build_path("/store/dummy-processor/1000/1500/file_id/file")
assert H.exfile_path(a_file(), processor: "dummy-processor", processor_args: ["1000", "1500"], format: "jpeg") == build_path("/store/dummy-processor/1000/1500/file_id/file.jpeg")
end

test "URL to file using %Plug.Conn{}" do
conn = %Plug.Conn{private: %{phoenix_endpoint: %{url: "https://phoenix.example"}}}
assert H.exfile_url(conn, a_file()) == ("https://phoenix.example" <> build_path("store/file_id/file"))
assert H.exfile_url(conn, a_file()) == ("https://phoenix.example" <> build_path("/store/file_id/file"))
end

test "URL to file using %Plug.Conn{} with format" do
conn = %Plug.Conn{private: %{phoenix_endpoint: %{url: "https://phoenix.example"}}}
assert H.exfile_url(conn, a_file(), format: "jpeg") == ("https://phoenix.example" <> build_path("store/file_id/file.jpeg"))
assert H.exfile_url(conn, a_file(), format: "jpeg") == ("https://phoenix.example" <> build_path("/store/file_id/file.jpeg"))
end

test "URL to file using %Phoenix.Socket{}" do
socket = %Phoenix.Socket{endpoint: DummyEndpoint}
assert H.exfile_url(socket, a_file()) == ("https://dummy.example" <> build_path("store/file_id/file"))
assert H.exfile_url(socket, a_file()) == ("https://dummy.example" <> build_path("/store/file_id/file"))
end

test "URL to file using %Phoenix.Socket{} with format" do
socket = %Phoenix.Socket{endpoint: DummyEndpoint}
assert H.exfile_url(socket, a_file(), format: "jpeg") == ("https://dummy.example" <> build_path("store/file_id/file.jpeg"))
assert H.exfile_url(socket, a_file(), format: "jpeg") == ("https://dummy.example" <> build_path("/store/file_id/file.jpeg"))
end

test "URL to file using %URI{}" do
uri = URI.parse("https://uri.example")
assert H.exfile_url(uri, a_file()) == ("https://uri.example" <> build_path("store/file_id/file"))
assert H.exfile_url(uri, a_file()) == ("https://uri.example" <> build_path("/store/file_id/file"))
end

test "URL to file using %URI{} with format" do
uri = URI.parse("https://uri.example")
assert H.exfile_url(uri, a_file(), format: "jpeg") == ("https://uri.example" <> build_path("store/file_id/file.jpeg"))
assert H.exfile_url(uri, a_file(), format: "jpeg") == ("https://uri.example" <> build_path("/store/file_id/file.jpeg"))
end

test "URL to file using an endpoint" do
endpoint = DummyEndpoint
assert H.exfile_url(endpoint, a_file()) == ("https://dummy.example" <> build_path("store/file_id/file"))
assert H.exfile_url(endpoint, a_file()) == ("https://dummy.example" <> build_path("/store/file_id/file"))
end

test "URL to file using an endpoint with format" do
endpoint = DummyEndpoint
assert H.exfile_url(endpoint, a_file(), format: "jpeg") == ("https://dummy.example" <> build_path("store/file_id/file.jpeg"))
assert H.exfile_url(endpoint, a_file(), format: "jpeg") == ("https://dummy.example" <> build_path("/store/file_id/file.jpeg"))
end

defmodule URLWithCDNHelpersTest do
Expand All @@ -107,13 +107,13 @@ defmodule Exfile.Phoenix.HelpersTest do
end

test "URL to file" do
assert H.exfile_url(a_file()) == ("https://exfile-host.example" <> build_path("store/file_id/file"))
assert H.exfile_url(a_file(), format: "jpeg") == ("https://exfile-host.example" <> build_path("store/file_id/file.jpeg"))
assert H.exfile_url(a_file()) == ("https://exfile-host.example" <> build_path("/store/file_id/file"))
assert H.exfile_url(a_file(), format: "jpeg") == ("https://exfile-host.example" <> build_path("/store/file_id/file.jpeg"))
end

test "URL to file using an endpoint will return CDN host when configured" do
assert H.exfile_url(DummyEndpoint, a_file()) == ("https://exfile-host.example" <> build_path("store/file_id/file"))
assert H.exfile_url(DummyEndpoint, a_file(), format: "jpeg") == ("https://exfile-host.example" <> build_path("store/file_id/file.jpeg"))
assert H.exfile_url(DummyEndpoint, a_file()) == ("https://exfile-host.example" <> build_path("/store/file_id/file"))
assert H.exfile_url(DummyEndpoint, a_file(), format: "jpeg") == ("https://exfile-host.example" <> build_path("/store/file_id/file.jpeg"))
end
end
end
14 changes: 7 additions & 7 deletions test/exfile/router_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Exfile.RouterTest do
end

test "returns 404 (file not found) on request to file that does not exist" do
conn = conn(:get, "/" <> Token.build_path("cache/1234/test"))
conn = conn(:get, Token.build_path("/cache/1234/test"))
conn = Router.call(conn, @opts)

assert conn.state == :sent
Expand All @@ -28,7 +28,7 @@ defmodule Exfile.RouterTest do
test "returns 200 on request to file that exists" do
contents = "hello there"
:ok = File.write(Path.expand("./tmp/cache/exists"), contents)
conn = conn(:get, "/" <> Token.build_path("cache/exists/test"))
conn = conn(:get, Token.build_path("/cache/exists/test"))
conn = Router.call(conn, @opts)

assert conn.state == :sent
Expand All @@ -49,10 +49,10 @@ defmodule Exfile.RouterTest do
end

test "returns 304 (not modified) on request with valid if-none-match" do
path = "cache/test/test"
path = "/cache/test/test"
token = Token.generate_token(path)
path = Path.join(token, path)
conn = conn(:get, "/" <> path, "") |> put_req_header("if-none-match", token)
conn = conn(:get, path, "") |> put_req_header("if-none-match", token)
conn = Router.call(conn, @opts)

assert conn.state == :sent
Expand All @@ -63,7 +63,7 @@ defmodule Exfile.RouterTest do
test "returns correctly processed file" do
contents = "hello there"
:ok = File.write(Path.expand("./tmp/cache/processtest"), contents)
conn = conn(:get, "/" <> Token.build_path("cache/reverse/processtest/test"))
conn = conn(:get, Token.build_path("/cache/reverse/processtest/test"))
conn = Router.call(conn, @opts)

assert conn.state == :sent
Expand All @@ -77,7 +77,7 @@ defmodule Exfile.RouterTest do
test "returns correctly processed file when processor saves to a tempfile" do
contents = "hello there"
:ok = File.write(Path.expand("./tmp/cache/processtest-tempfile"), contents)
conn = conn(:get, "/" <> Token.build_path("cache/reverse-tempfile/processtest-tempfile/test"))
conn = conn(:get, Token.build_path("/cache/reverse-tempfile/processtest-tempfile/test"))
conn = Router.call(conn, @opts)

assert conn.state == :sent
Expand All @@ -91,7 +91,7 @@ defmodule Exfile.RouterTest do
test "returns correctly processed file with arguments" do
contents = "hello there"
:ok = File.write(Path.expand("./tmp/cache/process-arg-test"), contents)
conn = conn(:get, "/" <> Token.build_path("cache/truncate/5/process-arg-test/test"))
conn = conn(:get, Token.build_path("/cache/truncate/5/process-arg-test/test"))
conn = Router.call(conn, @opts)

assert conn.state == :sent
Expand Down
Loading