def test_surt_cannot_be_created(self):
        system_nominator = models.Nominator.objects.get(id=settings.SYSTEM_NOMINATOR_ID)
        project = factories.ProjectFactory()
        url = None

        with pytest.raises(http.Http404):
            url_handler.surt_exists(project, system_nominator, url)
    def test_creates_surt_when_surt_does_not_exist(self):
        system_nominator = models.Nominator.objects.get(id=settings.SYSTEM_NOMINATOR_ID)
        project = factories.ProjectFactory()
        url = 'http://example.com'

        assert len(models.URL.objects.all()) == 0
        assert url_handler.surt_exists(project, system_nominator, url) is True
        assert len(models.URL.objects.all()) == 1
 def test_returns_true_with_existing_surt(self):
     system_nominator = models.Nominator.objects.get(id=settings.SYSTEM_NOMINATOR_ID)
     url = factories.SURTFactory()
     assert url_handler.surt_exists(url.url_project, system_nominator, url.entity) is True