def test_dashboard_group_with_dashboard_update_success(sfx_recorder, session, dashboard): with sfx_recorder.use_cassette( 'dashboard_group_with_dashboard_update_success', serialize_with='prettyjson'): dashboard_group = DashboardGroup(session=session) \ .with_name('spaceX') \ .with_dashboards( dashboard('Falcon99', 'chart1'), dashboard('FalconHeavy', 'chart2')) \ .with_api_token('foo') dashboard_group.update()
def test_dashboard_group_update_failure(sfx_recorder, session): dashboard_group = DashboardGroup(session=session) \ .with_name('spaceX') \ .with_api_token('foo') with sfx_recorder.use_cassette('dashboard_group_update_failure', serialize_with='prettyjson'): # Just to make sure there are multiple dashboard groups exists, # create a new dashboard group with the same name dashboard_group.create(force=True) dashboard_group.create(force=True) with pytest.raises(SignalAnalogError): # Verify that we can't update when multiple dashboard groups exist dashboard_group.update( name='updated_dashboard_group_name', description='updated_dashboard_group_description')
def test_dashboard_group_with_delete_existing_dashboard_update_success(sfx_recorder, session, dashboard): name = 'spaceX' with sfx_recorder.use_cassette( 'dashboard_group_with_delete_existing_dashboard_update_success', serialize_with='prettyjson'): dashboard_group = DashboardGroup(session=session) \ .with_name(name) \ .with_dashboards(dashboard('Draagoon', 'chart3')) \ .with_api_token('foo') response = dashboard_group.update() assert response['name'] == name assert len(response['dashboards']) == 1