mozilla / active-data-recipes

A repository of various activedata queries and recipes
Mozilla Public License 2.0
8 stars 24 forks source link

Add test for adr query --debug #54

Closed nikk15 closed 5 years ago

nikk15 commented 5 years ago

Added a test for when adr query --debug is run. This has simply been added to the original query test and is measured by asserting if the debug_url returned by the format_query() function with mock data input is either None (for no --debug) or is equal to the expected debug_url (for --debug included).

Currently this is tested with a separate .test file for the same query, triggered by the 'debug' key set to either True or False. I originally experimented with just the 'saved_as' key triggering debug or no debug in the test, but that was not achievable as 'saved_as' is used in query.py to set the build_debug_url() in motion.

For future additions to the query_tests folder, will we need a debug .test for each query? Or is it sufficient to ensure it works on just the one?

There is a minor issue which I am unsure how to rectify and welcome any advice please! When print_diff() is run for AssertionError, it looks like the result is in !!python/unicode, as opposed to its comparative expected data.

Any feedback is much appreciated. Thanks in advance!

Cheers.

nikk15 commented 5 years ago

Hey @ahal. I have made those changes as requested. The files I have modified pass the Travis CI, but recipe_test[seta_accuracy] does not.

Just wanted to let you know before I take a closer look!

ahal commented 5 years ago

Yeah, looks like that failure is unrelated to your changes (and the Travis build is passing other than that). So we can merge this anyway after I take a look.