def test_save_chart(self): chart = Chart(self.conn, 'test', space_id=self.space.id) self.assertFalse(chart.persisted()) self.assertIsNone(chart.id) resp = chart.save() self.assertIsInstance(resp, Chart) self.assertTrue(chart.persisted()) self.assertIsNotNone(chart.id) self.assertEqual(chart.type, 'line')
def test_chart_is_persisted_if_id_present(self): chart = Chart(self.conn, 'test', id=42) self.assertTrue(chart.persisted()) chart = Chart(self.conn, 'test', id=None) self.assertFalse(chart.persisted())
def test_chart_is_not_persisted(self): chart = Chart('not saved', self.space) self.assertFalse(chart.persisted())