Annotate zerver/tests/test_push_notifications.py.

This commit is contained in:
Umair Khan 2016-09-12 11:09:43 +05:00 committed by Tim Abbott
parent c231a440cd
commit 593779a3b0
1 changed files with 10 additions and 6 deletions

View File

@ -2,6 +2,7 @@ import mock
from mock import call from mock import call
import time import time
from typing import Any, Union, SupportsInt from typing import Any, Union, SupportsInt
from six import text_type
import gcmclient import gcmclient
@ -246,8 +247,9 @@ class GCMCanonicalTest(GCMTest):
res.needs_retry.return_value = False res.needs_retry.return_value = False
mock_send.return_value = res mock_send.return_value = res
def get_count(token): def get_count(hex_token):
token = apn.hex_to_b64(token) # type: (text_type) -> int
token = apn.hex_to_b64(hex_token)
return PushDeviceToken.objects.filter( return PushDeviceToken.objects.filter(
token=token, kind=PushDeviceToken.GCM).count() token=token, kind=PushDeviceToken.GCM).count()
@ -275,8 +277,9 @@ class GCMCanonicalTest(GCMTest):
res.needs_retry.return_value = False res.needs_retry.return_value = False
mock_send.return_value = res mock_send.return_value = res
def get_count(token): def get_count(hex_token):
token = apn.hex_to_b64(token) # type: (text_type) -> int
token = apn.hex_to_b64(hex_token)
return PushDeviceToken.objects.filter( return PushDeviceToken.objects.filter(
token=token, kind=PushDeviceToken.GCM).count() token=token, kind=PushDeviceToken.GCM).count()
@ -302,8 +305,9 @@ class GCMNotRegisteredTest(GCMTest):
res.needs_retry.return_value = False res.needs_retry.return_value = False
mock_send.return_value = res mock_send.return_value = res
def get_count(token): def get_count(hex_token):
token = apn.hex_to_b64(token) # type: (text_type) -> int
token = apn.hex_to_b64(hex_token)
return PushDeviceToken.objects.filter( return PushDeviceToken.objects.filter(
token=token, kind=PushDeviceToken.GCM).count() token=token, kind=PushDeviceToken.GCM).count()