Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: use baseclass implementation of monitor creation #74806

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from datetime import timedelta
from unittest import mock

from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from django.utils import timezone

from sentry.models.environment import Environment
from sentry.models.files.file import File
from sentry.monitors.models import CheckInStatus, MonitorCheckIn, MonitorEnvironment
from sentry.monitors.models import CheckInStatus, MonitorCheckIn
from sentry.testutils.cases import MonitorIngestTestCase


Expand All @@ -17,22 +14,6 @@ class MonitorIngestCheckinAttachmentEndpointTest(MonitorIngestTestCase):
def get_path(self, monitor, checkin):
return reverse(self.endpoint, args=[self.organization.slug, monitor.slug, checkin.guid])

def _create_monitor(self):
return self.create_monitor()

def _create_monitor_environment(self, monitor, name="production", **kwargs):
environment = Environment.get_or_create(project=self.project, name=name)

monitorenvironment_defaults = {
"status": monitor.status,
"next_checkin": timezone.now() - timedelta(minutes=1),
**kwargs,
}

return MonitorEnvironment.objects.create(
monitor=monitor, environment_id=environment.id, **monitorenvironment_defaults
)

def test_upload(self):
monitor = self._create_monitor()
monitor_environment = self._create_monitor_environment(monitor)
Expand Down
Loading