def testSetClientMeasurements(self): currTime = time.time() stats.setClientMeasurements("testUser", self.testInputJSON) for savedEntry in get_client_stats_db().find(): self.assertEquals(savedEntry['client_app_version'], '2.0.1') self.assertEquals(savedEntry['client_os_version'], '4.3') self.assertAlmostEqual(savedEntry['reported_ts'], time.time(), places=0) if savedEntry['stat'] == 'sync_pull_list_size': self.assertIn(savedEntry['ts'], [1411418998701, 1411418998702, 1411418998703]) self.assertIn(savedEntry['reading'], [1111, 2222, 3333])
def setStats(): user_uuid=getUUID(request) inStats = request.json['stats'] stats.setClientMeasurements(user_uuid, inStats)