def test_delete_widget(self): widget = widget_factory.create() with app.test_client() as c, authenticated_user(c): rv = json_request(c.delete, '/api/widgets/{0}'.format(widget.id)) self.assertEquals(rv.status_code, 200) dashboard = models.Dashboard.get_by_slug(widget.dashboard.slug) self.assertEquals(dashboard.widgets.count(), 0) self.assertEquals(dashboard.layout, '[]')