Skip to content

Commit

Permalink
Test that private classifiers can't be created
Browse files Browse the repository at this point in the history
  • Loading branch information
di committed Mar 24, 2020
1 parent cf9b3ef commit 9370491
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import requests

from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import joinedload
from trove_classifiers import classifiers
from webob.multidict import MultiDict
Expand Down Expand Up @@ -2896,6 +2897,25 @@ def test_all_valid_classifiers_can_be_created(self, db_request):
db_request.db.add(Classifier(classifier=classifier))
db_request.db.commit()

@pytest.mark.parametrize(
"parent_classifier",
[
"private",
"private",
"private",
"Private",
"Private",
"Private",
"PrIvAtE",
"PrIvAtE",
"PrIvAtE",
],
)
def test_private_classifiers_cannot_be_created(self, db_request, parent_classifier):
with pytest.raises(IntegrityError):
db_request.db.add(Classifier(classifier=f"{parent_classifier} :: Foo"))
db_request.db.commit()

def test_equivalent_version_one_release(self, pyramid_config, db_request, metrics):
"""
Test that if a release with a version like '1.0' exists, that a future
Expand Down

0 comments on commit 9370491

Please sign in to comment.