def test_broken_json(): normalizer = sentry_relay.StoreNormalizer(project_id=1) bad_str = u"Hello\ud83dWorld🇦🇹!" event = normalizer.normalize_event({"message": bad_str}) assert "Hello" in event["logentry"]["formatted"] assert "World" in event["logentry"]["formatted"] if not PY2: assert event["logentry"]["formatted"] != bad_str
def test_basic_store_normalization(): normalizer = sentry_relay.StoreNormalizer(project_id=1) event = normalizer.normalize_event({"tags": []}) assert event["project"] == 1 assert event["type"] == "default" assert event["platform"] == "other" assert "tags" not in event assert "received" in event
def test_legacy_json(): normalizer = sentry_relay.StoreNormalizer(project_id=1) event = normalizer.normalize_event(raw_event='{"extra":{"x":NaN}}') assert event["extra"] == {"x": 0.0}