lbry-sdk/tests/unit/analytics/test_track.py
Job Evers-Meltzer 813267ae18 fix tests
2016-10-20 11:29:58 -07:00

27 lines
778 B
Python

from lbrynet import analytics
from twisted.trial import unittest
class TrackTest(unittest.TestCase):
def test_empty_summarize_is_None(self):
track = analytics.Track()
_, result = track.summarize('a')
self.assertEqual(None, result)
def test_can_get_sum_of_metric(self):
track = analytics.Track()
track.add_observation('b', 1)
track.add_observation('b', 2)
_, result = track.summarize('b')
self.assertEqual(3, result)
def test_summarize_resets_metric(self):
track = analytics.Track()
track.add_observation('metric', 1)
track.add_observation('metric', 2)
track.summarize('metric')
_, result = track.summarize('metric')
self.assertEqual(None, result)