def test_new_graph(self): with self.assertRaises(TypeError): Graph() with self.assertRaises(AttributeError): Graph("1h") with self.assertRaises(KeyError): Graph({}, "foo") g = Graph({'GRAPHITE_BASE_URL': "foo"}, "1h") gd = g.get_dashboard(10, 10) ed = {'span': 12, 'title': None, 'height': 10, 'width': 10, 'img_src': 'foo/render?width=10&yMin=0&from=-1hour&height=10&', 'legend': ''} self.assertDictEqual(ed, gd)
def test_copy(self): g = Graph({'GRAPHITE_BASE_URL': "foo"}, "1h") g.add_series("foo.bar") p = Graph(g) self.assertListEqual([{'target': 'foo.bar'}], p._series)