Hi Dan,

        Thank you for your response!

        So, maybe what I need isn’t Test::Mojo. I have:

-----
package t::MockApp;

use Mojo::Base -strict;

use Mojolicious::Lite;

websocket '/my-websocket-endpoint' => sub { ... }
-----

        … and I’d like my tested $ua (Mojo::UserAgent->new()) to call logic 
defined in t::MockApp, rather than going out to the real world. I’d also like 
to define other mock server classes and have other parts of the test use those 
classes instead.

        I’ve tried “$ua->server->app($TEST_MOJO_APP) if $TEST_MOJO_APP” in my 
tested code, but that doesn’t seem to work. (The client times out rather than 
connecting to my WS server logic.)


-FG


> On Jan 22, 2020, at 10:40 AM, Dan Book <gri...@gmail.com> wrote:
> 
> You mentioned using Test::Mojo - the test file you mentioned does this, it 
> tests both client and server.
> 
> -Dan
> 
> On Wed, Jan 22, 2020 at 10:38 AM Dan Book <gri...@gmail.com> wrote:
> https://github.com/mojolicious/mojo/blob/master/t/mojo/websocket.t 
> 
> -Dan 
> 
> On Wed, Jan 22, 2020 at 10:34 AM Felipe Gasper <fel...@felipegasper.com> 
> wrote:
> Hello,
> 
>         I see t/mojolicious/websocket_lite_app.t in the Mojolicious 
> distribution, but this seems to test Mojo as a WS server. Are there any 
> examples of using Test::Mojo--or any other tool--to test Mojo-powered WS 
> clients?
> 
>         Thank you!
> 
> -FG
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to mojolicious+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/mojolicious/80877B50-2AD9-4C15-9410-52D74C104161%40felipegasper.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to mojolicious+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/mojolicious/CABMkAVVE1dvq-wv5HqTcXDExqUpOa4_%3DsZCZDh%3DZ7zJGvwDs4Q%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/1AADCC7B-E06A-49F5-9B4D-4BEB4FD4D46C%40felipegasper.com.

Reply via email to