Closed softprops closed 5 years ago
@ilianaw thoughts on this? I'm aiming for a more straight fwd unit testing story for crowbar functions.
Friendly nudge :)
@ilianaw I saw the pull approval. Can this be merged?
Actually first I'll fill in the remainder of methods.
ok @ilianaw pushed up the remaining impl
Yep!
fixes: #51
@ilianaw I took an initial stab at this. let me know what you think. Context here is I'd like to improve the story around unit testing. Atm this is not possible because the
new
constructor is private to callers and even it were public it would be awkward to construct with a bring-your-own-py api.I tried two approaches and settled on the second. I first tried extracting out LambdaContext into a trait but this required a change to the handler api so I punted on that. The second try was to make the existing LambdaContext type's a little more generalized. Rather than storing and operating on py objects it just operates on raw data. I created a new factory method named
fake
( open to other suggestions ) that creates a fakeLambdaContext
which is only available in test contexts. This avoids any any bloat to production binaries. I also sketched out a few methods that serve as "builder" style api also only available in the test context. This leaves the production binary interface immutable, as it should be :)Let me know what you think and if this looks good. I'll fill out the remaining builder methods.