bruth / django-tracking2

django-tracking2 tracks the length of time visitors and registered users spend on your site. Although this will work for websites, this is more applicable to web _applications_ with registered users. This does not replace (nor intend) to replace client-side analytics which is great for understanding aggregate flow of page views.
BSD 2-Clause "Simplified" License
205 stars 67 forks source link

Additional tests and fixes #44

Closed mjschultz closed 9 years ago

mjschultz commented 9 years ago

I've added a few more tests to get the code coverage up to about 90%. They're still not the best of tests, but they're getting better!

I accidentally made a slight regression in the last PR for a case that probably never happens (incoming unicode-typed User-Agent). I added a test and switched to using django's smart_text that does the magic for us.

Beyond that, I added tests for the managers and fixed up some bugs in them. More aggressively I removed most (all?) of the .date() calls so most of those pieces consume a full datetime now. A date can still be passed in, but it'll generate a RuntimeWarning when done. This codebase should be clean of that possibility, people using this codebase will have to deal with their own RuntimeWarnings.

I also added some datetime pickers to the base.html, so now it is obvious what time range is being shown to the user when they visit the page. I also updated the README to explicitly state that.

IMO this should resolve issues https://github.com/bruth/django-tracking2/issues/20, https://github.com/bruth/django-tracking2/issues/28, and https://github.com/bruth/django-tracking2/issues/39.

bruth commented 9 years ago

You are on a roll. This is great work. I will merge once the CI build completes.

mjschultz commented 9 years ago

Alright, I'm done adding tests now. On my box these changes get to about 96% coverage with the uncovered lines being ones that are hard to test/depend on specific versions of python and/or django.

This should allow safer refactoring of certain parts of the library and adding features as needed by others.

mjschultz commented 9 years ago

At long last it passes against all defined versions of django and python. Some features don't seem to work for certain versions of django/python though (specifically geoip on python 3+ with django 1.5.x). (Sorry if travis generated an email for all those failures!)

bruth commented 9 years ago

Marathon.