Journey Through Django–Process Hiccups

Writing the unit tests for the location aspect of the application has slowed a bit, mostly due to factors outside of coding. Still striving to find the right balance where I’m consistently making forward progress on everything I’m working on, and making iterative tweaks to my process.


There are a number of firsts for me in this project. In addition to being the first time working with Django, I’m also learning “the Django way” of doing tests. It’s also the first app where I’m testing integrations with a remote API. So deciphering which aspect I’m currently struggling with at any given moment has been tricky.

What I’ve Figured Out

So testing for the actual HTML that gets rendered on the page was no issue, as I simply repeated the pattern I used for the landing page. Now, I’m onto the background behavior of the page. One mistake I made was diving into some documentation without reading the metadata first. I searched for “Django, test client API.” Seems pretty straight-forward. After what seemed like hours of combing through Django rest framework API test, only to be more confused. I realized it was designed to test building an API in Django, not connecting to one. What I needed was the Python library urllib.

So I went through the geocoding API’s documentation & figured out how to work with it, and added what I thought was setup code before I wrote the test assertions. I had to do a hard stop & step away. I realized I was going in the wrong direction. While it’s useful to verify the data coming from the API, what I’m actually testing in this instance is the behavior of the form I’m building on the page.

More Research!

Okay, so new direction is set, and I’ve added a new learning topic to my to-do list. This has definitely been a muddy process, but learning what I need to learn as I need to learn it limits the number of “next steps” I need to concern myself with.

Leave a Reply