@attr('dashboards')
    def test_dash(self):
        graph = {
            "title": "test metric graph",
            "definition":
                {
                    "requests": [{"q": "testing.metric.1{host:blah.host.1}"}],
                    "viz": "timeseries",
                }
        }

        dash_id = dog.create_dashboard('api dash', 'my api dash', [graph])
        remote_dash = dog.dashboard(dash_id)

        eq('api dash', remote_dash['title'])
        eq('my api dash', remote_dash['description'])
        eq(graph['definition']['requests'], remote_dash['graphs'][0]['definition']['requests'])

        graph = {
            "title": "updated test metric graph",
            "definition": {
                "requests": [{"q": "testing.metric.1{host:blah.host.1}"}],
                "viz": "timeseries",
            }
        }

        dash_id = dog.update_dashboard(dash_id, 'updated api dash',
                                       'my updated api dash', [graph],
                                       template_variables=['foo', 'bar'])

        # Query and ensure all is well.
        remote_dash = dog.dashboard(dash_id)

        eq('updated api dash', remote_dash['title'])
        eq('my updated api dash', remote_dash['description'])
        self.assertEqual([
            {'default': None, 'name': 'foo', 'prefix': None},
            {'default': None, 'name': 'bar', 'prefix': None},
        ], remote_dash['template_variables'])

        p = graph['definition']['requests']
        eq(p, remote_dash['graphs'][0]['definition']['requests'])

        # Query all dashboards and make sure it's in there.

        dashes = dog.dashboards()
        ids = [dash["id"] for dash in dashes]
        assert dash_id in ids or str(dash_id) in ids

        dog.delete_dashboard(dash_id)

        try:
            d = dog.dashboard(dash_id)
        except:
            pass
        else:
            # the previous get *should* throw an exception
            assert False
dataset/ETHPy150Open DataDog/dogapi/tests/integration/test_dog_http_api.py/TestDatadog.test_dash/original