This commit is contained in:
@@ -2,6 +2,7 @@ from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import IntegrityError
|
||||
from django.utils import timezone
|
||||
|
||||
from apps.sources.models import Source, SourceRun
|
||||
@@ -40,3 +41,27 @@ def test_source_run_finish_updates_metrics(source):
|
||||
assert run.finished_at is not None
|
||||
assert run.http_status == 200
|
||||
assert run.extracted_count == 3
|
||||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_shared_ats_domain_accepts_distinct_public_feeds_but_not_duplicate_urls():
|
||||
Source.objects.create(
|
||||
name="Lever A",
|
||||
source_type=Source.Type.ATS,
|
||||
base_url="https://api.lever.co/v0/postings/a?mode=json",
|
||||
domain="api.lever.co",
|
||||
)
|
||||
Source.objects.create(
|
||||
name="Lever B",
|
||||
source_type=Source.Type.ATS,
|
||||
base_url="https://api.lever.co/v0/postings/b?mode=json",
|
||||
domain="api.lever.co",
|
||||
)
|
||||
|
||||
with pytest.raises(IntegrityError):
|
||||
Source.objects.create(
|
||||
name="Lever A dubbel",
|
||||
source_type=Source.Type.ATS,
|
||||
base_url="https://api.lever.co/v0/postings/a?mode=json",
|
||||
domain="api.lever.co",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user