def test_dashboard_create_with_filters_source_with_missing_property_and_value_failure(session, chart): with pytest.raises(ValueError): aws_src = FilterSource() dashboard_filter = DashboardFilters() \ .with_sources(aws_src) Dashboard(session=session) \ .with_name('testy mctesterson') \ .with_api_token('foo') \ .with_charts(chart('lol')) \ .with_filters(dashboard_filter) \ .create()
def test_dashboard_create_with_filters_source_with_empty_value_failure(): with pytest.raises(ValueError): aws_src = FilterSource() \ .with_property("aws_region") \ .with_value("") dashboard_filter = DashboardFilters() \ .with_sources(aws_src) Dashboard(session=global_session) \ .with_name('testy mctesterson') \ .with_api_token('foo') \ .with_charts(mk_chart('lol')) \ .with_filters(dashboard_filter) \ .create()
def test_dashboard_create_with_filters_source_success(sfx_recorder, session, chart): aws_src = FilterSource()\ .with_property("aws_region")\ .with_value("us-west-2") dashboard_filter = DashboardFilters()\ .with_sources(aws_src) with sfx_recorder.use_cassette('dashboard_create_with_filters_source_success', serialize_with='prettyjson'): Dashboard(session=session)\ .with_name('testy mctesterson')\ .with_api_token('foo')\ .with_charts(chart('lol'))\ .with_filters(dashboard_filter)\ .create()
app_filter = DashboardFilters() \ .with_variables(app_var, env_var) dashboard_with_multiple_filter_variables = Dashboard()\ .with_name('Dashboard With Multiple Filters')\ .with_charts(chart)\ .with_filters(app_filter) """ Example 3: Creating a new Dashboard with source filter """ # With the same filters as above example, program = Data('cpu.utilization', filter=filters).publish() chart = TimeSeriesChart().with_name('Chart_Name').with_program(program) aws_src = FilterSource().with_property("aws_region").with_value('us-west-2') app_filter = DashboardFilters() \ .with_sources(aws_src) dashboard_with_source_filter = Dashboard()\ .with_name('Dashboard With Source Filter')\ .with_charts(chart)\ .with_filters(app_filter) """ Example 4: Creating a new Dashboard with time(as string) filter """ # With the same filters as above example, program = Data('cpu.utilization', filter=filters).publish() chart = TimeSeriesChart().with_name('Chart_Name').with_program(program)