Re: [Mojolicious] Test::Mojo to test WS client?
> On Jan 22, 2020, at 12:25 PM, Felipe Gasper wrote: > > 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.) Follow-up: I have this working but only if I alter the tested logic to give a relative URL rather than an absolute URL to $tx->websocket(). Is there any tooling in place for handling absolute URLs in such setups? I can override $tx->websocket() but wonder if there’s any ready-made sugar for this. 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/C643F292-7C2E-4E82-B794-9B4446AD4D6E%40felipegasper.com.
Re: [Mojolicious] Test::Mojo to test WS client?
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 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 wrote: > https://github.com/mojolicious/mojo/blob/master/t/mojo/websocket.t > > -Dan > > On Wed, Jan 22, 2020 at 10:34 AM Felipe Gasper > 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.
Re: [Mojolicious] Test::Mojo to test WS client?
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 wrote: > https://github.com/mojolicious/mojo/blob/master/t/mojo/websocket.t > > -Dan > > On Wed, Jan 22, 2020 at 10:34 AM Felipe Gasper > 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.
Re: [Mojolicious] Test::Mojo to test WS client?
https://github.com/mojolicious/mojo/blob/master/t/mojo/websocket.t -Dan On Wed, Jan 22, 2020 at 10:34 AM Felipe Gasper 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/CABMkAVVwPgA-ShmkE1q5h-FvHzHUJNhbMtfEyy5FYVzW1%2BihWg%40mail.gmail.com.
[Mojolicious] Test::Mojo to test WS client?
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.