HTTP mocking and the Azure SDK
Harish Navnit (~tinvaan) |
Writing unit tests is fundamental to the health of your project. However, rarely are projects self-contained and often interact with a whole variety of external dependencies. In such cases, it is important that our unit tests do not act as live and anonymous user journeys, consuming both time and precious rate limiting API bandwith.
Mocking stubs or functions isn't a novel idea in itself, but doing so against a service as complex and vast as the Microsoft Azure cloud comes with it's own nuances. In this talk, we explore at some ways to achieve this and outline some of the popular means to achieve this within the developer community.
Some of the solutions we will go over are -
- Naive native and manual patching.
- Leveraging a HTTP interaction recorder.
- Implementing a custom transport for the Azure SDK.
- Writing a mocking library for stateful and dynamic responses.
Basic understanding of Python is all that's needed. Some exposure to public clouds(AWS, Azure etc) would be beneficial.
I'm a software engineer currently building software solutions around popular public cloud infrastructures such as AWS and Azure at ColoTokens Inc. I'm a free software enthusiast and have been leveraging Python to build developer friendly tools, in line with improving developer productivity and/or engineering effectiveness.
In the past, I was an active contributor to many free software projects. Most prominently, I was involved in the port of few KDE projects from Qt4 to Qt5/Qml API's as part of the GSoC '15 & '16 programs. I love the community involvement that free software projects bring and aim to experience it again during PyCon '21.