diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 5870c2f38..ef9f8d17d 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -5,6 +5,10 @@ Changelog **Upgrade Procedure:** Please follow :ref:`upgrading-kegbot` for general upgrade steps. +Current Version (in development) +-------------------------------- +* Bugfix: Issue #302 (api ``status/`` endpoint). + Version 1.0.0 (2014-06-24) -------------------------- * Initial 1.0 release. diff --git a/pykeg/web/api/api_test.py b/pykeg/web/api/api_test.py index ed0483196..e47493506 100644 --- a/pykeg/web/api/api_test.py +++ b/pykeg/web/api/api_test.py @@ -189,9 +189,16 @@ def test_record_drink(self): self.assertEquals(data.error.code, 'NoAuthTokenError') response, data = self.post('taps/1', HTTP_X_KEGBOT_API_KEY=self.apikey.key, - data={'ticks': 1000}) + data={'ticks': 1000, 'username': self.normal_user.username}) self.assertEquals(data.meta.result, 'ok') + response, data = self.get('status', HTTP_X_KEGBOT_API_KEY=self.apikey.key) + self.assertEquals(data.meta.result, 'ok') + users = data.object.get('active_users', []) + self.assertEquals(1, len(users)) + active_user = users[0] + self.assertEquals(self.normal_user.username, active_user.username) + @override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend') @override_settings(EMAIL_FROM_ADDRESS='test-from@example') def test_registration(self): diff --git a/pykeg/web/api/views.py b/pykeg/web/api/views.py index 13b060b49..9eb102d91 100644 --- a/pykeg/web/api/views.py +++ b/pykeg/web/api/views.py @@ -264,7 +264,7 @@ def get_status(request): current_users = set() if session: - for stat in models.Stats.objects.filter(session=session): + for stat in models.Stats.objects.filter(session=session, user__isnull=False): user = stat.user if not user.is_guest(): current_users.add(user) diff --git a/setup.py b/setup.py index 118b2d720..d2a75a221 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from setuptools import setup, find_packages -VERSION = '1.0.0' +VERSION = '1.0.1a1' DOCLINES = __doc__.split('\n') SHORT_DESCRIPTION = DOCLINES[0]