@@ -399,6 +399,19 @@ def test_affiliated_institutions_are_copied_from_user(self, app, user, url_draft
399399 draft_registration = DraftRegistration .load (res .json ['data' ]['id' ])
400400 assert list (draft_registration .affiliated_institutions .all ()) == list (user .get_affiliated_institutions ())
401401
402+ def test_cannot_create_draft_when_provider_disallows_submissions (
403+ self , app , user , provider , payload , url_draft_registrations ):
404+ provider .allow_submissions = False
405+ provider .save ()
406+
407+ res = app .post_json_api (
408+ url_draft_registrations ,
409+ payload ,
410+ auth = user .auth ,
411+ expect_errors = True ,
412+ )
413+ assert res .status_code == 409
414+
402415
403416class TestDraftRegistrationCreateWithoutNode (AbstractDraftRegistrationTestCase ):
404417 @pytest .fixture ()
@@ -451,6 +464,19 @@ def test_create_draft_with_provider(
451464 draft = DraftRegistration .load (data ['id' ])
452465 assert draft .provider == non_default_provider
453466
467+ def test_cannot_create_draft_when_provider_disallows_submissions (
468+ self , app , user , url_draft_registrations , non_default_provider , payload_with_non_default_provider ):
469+ non_default_provider .allow_submissions = False
470+ non_default_provider .save ()
471+
472+ res = app .post_json_api (
473+ url_draft_registrations ,
474+ payload_with_non_default_provider ,
475+ auth = user .auth ,
476+ expect_errors = True ,
477+ )
478+ assert res .status_code == 409
479+
454480 def test_write_contrib (self , app , user , project_public , payload , url_draft_registrations , user_write_contrib ):
455481 """(no node supplied, so any logged in user can create)
456482 """
0 commit comments