self.assertIn('60', [e['name'] for e in respsize_stats])
self.assertIn('example.com/A', [e['name'] for e in queries_stats])
self.assertIn('No Error', [e['name'] for e in rcode_stats])
+
+ def test_read_one_statistic(self):
+ r = self.session.get(self.url("/api/v1/servers/localhost/statistics?statistic=uptime"))
+ self.assert_success_json(r)
+ data = r.json()
+ self.assertIn('uptime', [e['name'] for e in data])
+
+ def test_read_one_non_existent_statistic(self):
+ r = self.session.get(self.url("/api/v1/servers/localhost/statistics?statistic=uptimeAAAA"))
+ self.assertEquals(r.status_code, 422)
+ self.assertIn("Unknown statistic name", r.json()['error'])