docstr: ReportSchedule Api: Test create report schedule
  relations (chart, dash, db) exist
docstr_tok: ["ReportSchedule","Api",":","Test","create","report","schedule","relations","(","chart",",","dash",",","db",")","exist"]
code: def test_create_report_schedule_relations_exist(self):
      """
      ReportSchedule Api: Test create report schedule
      relations (chart, dash, db) exist
      """
      self.login(username="admin")
  
      # Test chart and database do not exist
      chart_max_id = db.session.query(func.max(Slice.id)).scalar()
      database_max_id = db.session.query(func.max(Database.id)).scalar()
      examples_db = get_example_database()
      report_schedule_data = {
          "type": ReportScheduleType.ALERT,
          "name": "new3",
          "description": "description",
          "creation_method": ReportCreationMethod.ALERTS_REPORTS,
          "crontab": "0 9 * * *",
          "chart": chart_max_id + 1,
          "database": database_max_id + 1,
      }
      uri = "api/v1/report/"
      rv = self.post_assert_metric(uri, report_schedule_data, "post")
      assert rv.status_code == 422
      data = json.loads(rv.data.decode("utf-8"))
      assert data == {
          "message": {
              "chart": "Chart does not exist",
              "database": "Database does not exist",
          }
      }
  
      # Test dashboard does not exist
      dashboard_max_id = db.session.query(
          func.max(Dashboard.id)
      ).scalar()
      report_schedule_data = {
          "type": ReportScheduleType.ALERT,
          "name": "new3",
          "description": "description",
          "crontab": "0 9 * * *",
          "creation_method": ReportCreationMethod.ALERTS_REPORTS,
          "dashboard": dashboard_max_id + 1,
          "database": examples_db.id,
      }
      uri = "api/v1/report/"
      rv = self.post_assert_metric(uri, report_schedule_data, "post")
      assert rv.status_code == 422
      data = json.loads(rv.data.decode("utf-8"))
      assert data == {
          "message": {"dashboard": "Dashboard does not exist"}
      }
  
imports: from datetime import datetime
  import json
  import pytz
  import pytest
  import prison
  from parameterized import parameterized
  from sqlalchemy.sql import func
  from superset import db, security_manager
  from superset.models.core import Database
  from superset.models.slice import Slice
  from superset.models.dashboard import Dashboard
  from superset.reports.models import ReportSchedule, ReportCreationMethod, ReportRecipients, ReportExecutionLog, ReportScheduleType, ReportRecipientType, ReportState
  from superset.utils.database import get_example_database
  from tests.integration_tests.base_tests import SupersetTestCase
  from tests.integration_tests.conftest import with_feature_flags
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  from tests.integration_tests.reports.utils import insert_report_schedule
label_desc: Use image node_id 30 for calling the TestReportSchedulesApi obj's underlying member method code with example usage: obj.test_create_report_schedule_relations_exist() without return types