def test_save_persists_use_last_value(self):
     chart = Chart(self.conn, space_id=self.space.id)
     self.assertIsNone(chart.use_last_value)
     chart.use_last_value = True
     chart.save()
     found = self.conn.get_chart(chart.id, self.space.id)
     self.assertTrue(found.use_last_value)
 def test_save_persists_related_space(self):
     chart = Chart(self.conn, space_id=self.space.id)
     self.assertIsNone(chart.related_space)
     chart.related_space = 1234
     chart.save()
     found = self.conn.get_chart(chart.id, self.space.id)
     self.assertTrue(found.related_space)
 def test_save_persists_log_y_axis(self):
     chart = Chart(self.conn, space_id=self.space.id)
     self.assertIsNone(chart.use_log_yaxis)
     chart.use_log_yaxis = True
     chart.save()
     found = self.conn.get_chart(chart.id, self.space.id)
     self.assertTrue(found.use_log_yaxis)
 def test_save_persists_label(self):
     chart = Chart(self.conn, space_id=self.space.id)
     self.assertIsNone(chart.label)
     chart.label = 'my label'
     chart.save()
     found = self.conn.get_chart(chart.id, self.space.id)
     self.assertEqual(found.label, 'my label')
 def test_save_persists_type(self):
     # Ensure that type gets passed in the payload
     for t in ['stacked', 'bignumber']:
         chart = Chart(self.conn, space_id=self.space.id, type=t)
         chart.save()
         found = self.conn.get_chart(chart.id, self.space.id)
         self.assertEqual(found.type, t)
 def test_save_persists_min_max(self):
     chart = Chart(self.conn, space_id=self.space.id)
     self.assertIsNone(chart.min)
     self.assertIsNone(chart.max)
     chart.min = 5
     chart.max = 30
     chart.save()
     found = self.conn.get_chart(chart.id, self.space.id)
     self.assertEqual(found.min, 5)
     self.assertEqual(found.max, 30)
 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')