def test_make_it(self): sot = statistics.Statistics(EXAMPLE) self.assertIsNone(sot.id) self.assertEqual(EXAMPLE['aggregate'], sot.aggregate) self.assertEqual(EXAMPLE['avg'], sot.avg) self.assertEqual(EXAMPLE['count'], sot.count) self.assertEqual(EXAMPLE['duration'], sot.duration) dt = datetime.datetime(2015, 3, 9, 12, 45, 00, 000000).replace( tzinfo=None) self.assertEqual(dt, sot.duration_end_at.replace(tzinfo=None)) dt = datetime.datetime(2015, 3, 9, 12, 15, 00, 000000).replace( tzinfo=None) self.assertEqual(dt, sot.duration_start_at.replace(tzinfo=None)) self.assertEqual(EXAMPLE['groupby'], sot.group_by) self.assertEqual(EXAMPLE['max'], sot.max) self.assertEqual(EXAMPLE['min'], sot.min) self.assertEqual(EXAMPLE['period'], sot.period) dt = datetime.datetime(2015, 3, 9, 12, 45, 00, 000000).replace( tzinfo=None) self.assertEqual(dt, sot.period_end_at.replace(tzinfo=None)) dt = datetime.datetime(2015, 3, 9, 12, 15, 00, 000000).replace( tzinfo=None) self.assertEqual(dt, sot.period_start_at.replace(tzinfo=None)) self.assertEqual(EXAMPLE['sum'], sot.sum) self.assertEqual(EXAMPLE['unit'], sot.unit)
def test_basic(self): sot = statistics.Statistics() self.assertEqual('statistics', sot.resource_key) self.assertIsNone(sot.resources_key) self.assertEqual('/meters/%(meter_name)s/statistics', sot.base_path) self.assertEqual('metering', sot.service.service_type) self.assertFalse(sot.allow_create) self.assertFalse(sot.allow_retrieve) self.assertFalse(sot.allow_update) self.assertFalse(sot.allow_delete) self.assertTrue(sot.allow_list)
def test_make_it(self): sot = statistics.Statistics(EXAMPLE) self.assertIsNone(sot.id) self.assertEqual(EXAMPLE['aggregate'], sot.aggregate) self.assertEqual(EXAMPLE['avg'], sot.avg) self.assertEqual(EXAMPLE['count'], sot.count) self.assertEqual(EXAMPLE['duration'], sot.duration) self.assertEqual(EXAMPLE['duration_end'], sot.duration_end) self.assertEqual(EXAMPLE['duration_start'], sot.duration_start) self.assertEqual(EXAMPLE['groupby'], sot.group_by) self.assertEqual(EXAMPLE['max'], sot.max) self.assertEqual(EXAMPLE['min'], sot.min) self.assertEqual(EXAMPLE['period'], sot.period) self.assertEqual(EXAMPLE['period_end'], sot.period_end) self.assertEqual(EXAMPLE['period_start'], sot.period_start) self.assertEqual(EXAMPLE['sum'], sot.sum) self.assertEqual(EXAMPLE['unit'], sot.unit)