problem in using MockWeb

41 views
Skip to first unread message

shigang zhong

unread,
Feb 23, 2016, 2:42:12 AM2/23/16
to Lift
According to https://www.assembla.com/wiki/show/liftweb/Mocking_HTTP_Requests,I tried the following code, then encounter a problem, 

import net.liftweb.mockweb.MockWeb._
...

        S.param("b") should be(Full("c"))
      }

it's messages is:
[info]   Empty was not equal to Full(c) (MySnippetTest.scala:77)

But the following code works well,

      testReq("http://foo.com/test/this?a=b&a=c", "/test") {
        req =>
          req.uri should be("/this")
          req.params("a") should be(List("b", "c"))
      }

Somebody can give me a cue? 

My environments is:
sbt.version=0.13.8

scalaVersion := "2.11.6"
"net.liftweb" %% "lift-testkit" % "3.0-M8" % "test",

Thanks!

Antonio Salazar Cardozo

unread,
Feb 24, 2016, 9:18:24 AM2/24/16
to Lift
That does seem odd… Will try and have a look at it later today.
Thanks,
Antonio

Antonio Salazar Cardozo

unread,
Feb 24, 2016, 11:31:33 PM2/24/16
to Lift
Any chance you can post an example project? I'm a little short
on time atm and that would help me get right to looking into what's
going sideways.
Thanks!
Antonio

shigang zhong

unread,
Feb 25, 2016, 12:53:54 AM2/25/16
to Lift
https://github.com/zhongsigang/testLiftweb.git

Thanks!

在 2016年2月25日星期四 UTC+8下午12:31:33,Antonio Salazar Cardozo写道:

shigang zhong

unread,
Feb 26, 2016, 12:34:55 AM2/26/16
to Lift
I found the issue. The testS is not tackable for S. So S.initIfUninitted(session) { test() } can not appear in withFixture.

Thanks.

shigang zhong

unread,
Feb 26, 2016, 12:37:07 AM2/26/16
to Lift


Thanks.

Antonio Salazar Cardozo

unread,
Feb 26, 2016, 10:33:00 AM2/26/16
to Lift
Ah, so the issue at hand was that you were initializing S, and then
inside that you were trying to set up a testS call which attempted to
re-initialize it (and failed)?
Thanks,
Antonio

shigang zhong

unread,
Feb 27, 2016, 12:13:04 AM2/27/16
to Lift
Yes, it is exactly what you say. I'm sorry to spend your time. 

Thanks! 

在 2016年2月26日星期五 UTC+8下午11:33:00,Antonio Salazar Cardozo写道:

Antonio Salazar Cardozo

unread,
Feb 28, 2016, 12:32:31 PM2/28/16
to Lift
No problem at all, hopefully this will be useful if someone else runs into
the same issue :)

Thanks for sharing the solution!
Antonio
Reply all
Reply to author
Forward
0 new messages