Skip to content

Commit

Permalink
api: Fix status endpoint.
Browse files Browse the repository at this point in the history
Closes #302.
  • Loading branch information
mik3y committed Jun 26, 2014
1 parent ad4b99c commit 104a47f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion pykeg/web/api/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pykeg/web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 104a47f

Please sign in to comment.