Unit testing with S (and SiteMap)

52 views
Skip to first unread message

Derek Chen-Becker

unread,
Jan 17, 2011, 10:25:44 AM1/17/11
to liftweb
https://www.assembla.com/wiki/show/liftweb/Mocking_HTTP_Requests

I'll put this into Exploring Lift later tonight when the boys are asleep ;)

TylerWeir

unread,
Jan 17, 2011, 11:02:30 AM1/17/11
to lif...@googlegroups.com
I sure if you described it to them, they'd fall asleep.

I know Madeline would be out like a light. :)

Diego Medina

unread,
Jan 17, 2011, 11:30:13 AM1/17/11
to lif...@googlegroups.com

Thanks for adding the wiki and replying to my other email Derek

Diego

> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>

--
Diego Medina
Web Developer
http://www.fmpwizard.com

Derek Chen-Becker

unread,
Jan 17, 2011, 1:52:09 PM1/17/11
to lif...@googlegroups.com
No worries. I think I should be able to get functionality in this week that will simplify this kind of testing.

Derek




Jeff May

unread,
May 18, 2013, 2:39:45 PM5/18/13
to lif...@googlegroups.com
Thanks for creating this documentation and posting the link. I found this on google while searching for how to mock a session with a SiteMap and found this thread.

When I looked at the section for SiteMap, this is all it says:

SiteMap and Loc with Mock Requests

Determining the proper Loc for a given Req is simple:


val currentLoc = SiteMap.findLoc(request1)
But what I was looking for was how to mock a request with a given sitemap. Something like:

def testCustomSiteMap() {
  val customSiteMap
= SiteMap(
   
Menu("Home") / "index"
 
)
 
// testSiteMap? testLiftRules? testS with a LiftSession that has a SiteMap?
  testReq
("/home") { req =>
   
// do test
 
}
}

Is this possible?

My use case is that I want to test custom LocParams and code that builds sitemaps.

Thanks!

 - Jeff

Diego Medina

unread,
May 18, 2013, 10:39:03 PM5/18/13
to Lift
HI,

Look at this example



it is how to test a rest endpoint, and on the test you will see a custom boot class:



Hope it helps.

  Diego



--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
 
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://fmpwizard.telegr.am
Reply all
Reply to author
Forward
0 new messages