pedestal

demonshreder 2019-03-13T10:26:38.029700Z

https://clojars.org/column/lein-template https://gitlab.com/demonshreder/column A leiningen template based on pedestal

Jonathan 2019-03-13T19:32:09.030900Z

Hi y’all, what is the best practice for altering the list of middlewares when unit testing with response-for? I need to do things like disabling authentication and rate limiting

ccann 2019-03-13T20:33:44.031600Z

I have my authentication interceptors depend on resources that are mocked out via test fixtures

ccann 2019-03-13T20:34:10.032200Z

so if I want to run tests in a namespace where authentication is “disabled” I can use that fixture

ccann 2019-03-13T20:35:15.033100Z

also building up interceptor chains and testing them with chain/execute was recommended a few days ago to test those interceptor (sub)chains

2019-03-13T20:42:30.035900Z

@jonathan617, another alternative is to assoc dependencies to the service map and refer to them during service initialization when building the interceptor chain. A good example of this is found with Pedestal’s io.pedestal.http/default-interceptors implementation (https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/http.clj#L182). This way you can swap out the impls to use depending on your needs.

Jonathan 2019-03-13T20:46:03.036200Z

Thanks guys 🙂