mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Implement bookkeeping of events_at
(I didn't think the effects on regressions through, but this will at least manifest itself because you cannot mark an issue as "fixed in" a release in which it occurs. It will also show up once we start displaying "events_at" in the UI, which should be "soon")
This commit is contained in:
@@ -19,6 +19,8 @@ from .views import BaseIngestAPIView
|
||||
|
||||
|
||||
class IngestViewTestCase(DjangoTestCase):
|
||||
# this TestCase started out as focussed on alert-sending, but has grown beyond that. Sometimes simply by extending
|
||||
# existing tests. This is not a problem in itself, but may be slightly confusing if you don't realize that.
|
||||
|
||||
def setUp(self):
|
||||
# the existence of loud/quiet reflect that parts of this test focusses on alert-sending
|
||||
@@ -54,6 +56,8 @@ class IngestViewTestCase(DjangoTestCase):
|
||||
self.assertTrue(send_new_issue_alert.delay.called)
|
||||
self.assertFalse(send_regression_alert.delay.called)
|
||||
self.assertFalse(send_unmute_alert.delay.called)
|
||||
self.assertEquals(1, Issue.objects.count())
|
||||
self.assertEquals("\n", Issue.objects.get().events_at)
|
||||
self.assertEquals(1, TurningPoint.objects.count())
|
||||
self.assertEquals(TurningPointKind.FIRST_SEEN, TurningPoint.objects.first().kind)
|
||||
|
||||
@@ -227,6 +231,20 @@ class IngestViewTestCase(DjangoTestCase):
|
||||
request,
|
||||
)
|
||||
|
||||
def test_ingest_view_stores_events_at(self):
|
||||
request = self.request_factory.post("/api/1/store/")
|
||||
|
||||
event_data = create_event_data()
|
||||
event_data["release"] = "1.0"
|
||||
|
||||
BaseIngestAPIView().process_event(
|
||||
event_data,
|
||||
self.loud_project,
|
||||
request,
|
||||
)
|
||||
self.assertEquals(1, Issue.objects.count())
|
||||
self.assertEquals("1.0\n", Issue.objects.get().events_at)
|
||||
|
||||
|
||||
class TimeZoneTesCase(DjangoTestCase):
|
||||
"""This class contains some tests that formalize my understanding of how Django works; they are not strictly tests
|
||||
|
||||
@@ -178,7 +178,7 @@ class BaseIngestAPIView(APIView):
|
||||
# multiple events with the same event_id "don't happen" (i.e. are the result of badly misbehaving clients)
|
||||
raise ValidationError("Event already exists", code="event_already_exists")
|
||||
|
||||
create_release_if_needed(ingested_event.project, event.release, event)
|
||||
release = create_release_if_needed(ingested_event.project, event.release, event)
|
||||
|
||||
if issue_created:
|
||||
TurningPoint.objects.create(
|
||||
@@ -225,7 +225,8 @@ class BaseIngestAPIView(APIView):
|
||||
issue_pc = get_pc_registry().by_issue[issue.id]
|
||||
issue_pc.inc(ingested_event.timestamp, counted_entity=event)
|
||||
|
||||
# TODO bookkeeping of events_at goes here.
|
||||
if release.version + "\n" not in issue.events_at:
|
||||
issue.events_at += release.version + "\n"
|
||||
issue.save()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user