The "recommended" approach for doing this would be to create a DummyRequest and 
then use its route_url, etc methods. This will allow you to use Pyramid's 
actual url generation apis instead of re-implementing them yourself, as well as 
avoiding needing to use the private route mapper.

req = DummyRequest()
req.route_url(...)

It's natural to use the DummyRequest as well because Pyramid's url generation 
facilities are always relative to the properties of a WSGI request like scheme, 
host, script_name, etc.

That being said your fixtures look great.

- Michael

> On Dec 6, 2020, at 04:41, Lele Gaifax <[email protected]> wrote:
> 
> Hi all,
> 
> I'm used to have something like the following in my tests setup:
> 
>  
> https://gitlab.com/metapensiero/SoL/-/blob/master/tests/server/conftest.py#L45
> 
> that allows me to use the route name in my tests instead of the view URL,
> like:
> 
>  
> https://gitlab.com/metapensiero/SoL/-/blob/master/tests/server/test_data.py#L15
> 
> I wonder if I'm missing some existing similar facility, of if instead that
> approach could be suggested in the documentation, say here
> 
>  
> https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/testing.html#creating-functional-tests
> 
> What do you think?
> 
> Thanks&bye, lele.
> -- 
> nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
> real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
> [email protected]  |                 -- Fortunato Depero, 1929.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pylons-discuss/87h7ozqkqx.fsf%40metapensiero.it.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/857B2A48-5263-4423-B664-03ED42B8311E%40gmail.com.

Reply via email to