FFFF Issues when testing · Issue #87 · wookay/Bukdu.jl · GitHub
[go: up one dir, main page]

Skip to content

Issues when testing #87

Closed
Closed

Description

@lucianolorenti

Hi! I am writing a few tests of my app and I facing an issue

using Bukdu
using Test
struct IndexController <: ApplicationController
    conn::Conn
end
function something(c::IndexController)
    data = c.conn.params[:data]
    return Bukdu.render(JSON,  Dict("status"=>data=="data"))
end
function config_routes()
    routes() do
        post("/something", IndexController, something)
    end
end
function test_something()
    config_routes()
    response = Bukdu.Router.call(post,
                            "/something",
                            ["Content-Type" => "application/json"],
                            JSON.json(Dict("data"=>"data")))
                            
    @test response.got["message"] = true
end
test_something()

And I got a INFO: POST MissingController not_found 404 /something

I solved using invokelatest

    response = Base.invokelatest(Bukdu.Router.call,
                            post,
                            "/something",
                            ["Content-Type" => "application/json"],
                            JSON.json(Dict("data"=>"data")))

Is this intended, should I be testing in a different way?

Activity

  1. added a commit that references this issue on Feb 2, 2020
    eb42a97
  2. added a commit that references this issue on Feb 2, 2020
    d11698e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0