@@ -48,6 +48,27 @@ def test_when_create_project_it_works(kili_api_gateway: KiliAPIGateway):
4848 assert project_id == "fake_project_id"
4949
5050
51+ def test_when_create_project_without_inputType_or_jsonInterface_it_throw_an_error (
52+ kili_api_gateway : KiliAPIGateway ,
53+ ):
54+ kili_api_gateway .create_project .return_value = "fake_project_id"
55+
56+ # When
57+ project_use_cases = ProjectUseCases (kili_api_gateway )
58+
59+ # Then
60+ with pytest .raises (
61+ ValueError ,
62+ match = "Arguments `input_type` and `json_interface` must be set\n if no `project_id` is providen." ,
63+ ):
64+ project_use_cases .create_project (
65+ title = "test" ,
66+ description = "description" ,
67+ project_type = None ,
68+ compliance_tags = None ,
69+ )
70+
71+
5172def test_when_create_project_with_project_id_it_works (kili_api_gateway : KiliAPIGateway ):
5273 # Given
5374 tags = [
@@ -58,14 +79,13 @@ def test_when_create_project_with_project_id_it_works(kili_api_gateway: KiliAPIG
5879 kili_api_gateway .get_project .return_value = {
5980 "jsonInterface" : interface ,
6081 "instructions" : "fake_instructions" ,
82+ "inputType" : "TEXT" ,
6183 }
6284 kili_api_gateway .list_tags_by_project .return_value = tags
6385 kili_api_gateway .list_tags_by_org .return_value = tags
6486
6587 # When
6688 project_id = ProjectUseCases (kili_api_gateway ).create_project (
67- input_type = "TEXT" ,
68- json_interface = interface ,
6989 title = "test" ,
7090 description = "description" ,
7191 project_id = ProjectId ("fake_project_id" ),
@@ -91,6 +111,7 @@ def test_when_create_project_with_project_id_it_throw_an_error_if_tags_do_not_be
91111 kili_api_gateway .get_project .return_value = {
92112 "jsonInterface" : interface ,
93113 "instructions" : "fake_instructions" ,
114+ "inputType" : "TEXT" ,
94115 }
95116 kili_api_gateway .list_tags_by_project .return_value = tags
96117 kili_api_gateway .list_tags_by_org .return_value = org_tags
@@ -102,8 +123,6 @@ def test_when_create_project_with_project_id_it_throw_an_error_if_tags_do_not_be
102123 match = "Tag tag1_id doesn't belong to your organization and was not copied." ,
103124 ):
104125 project_use_cases .create_project (
105- input_type = "TEXT" ,
106- json_interface = interface ,
107126 title = "test" ,
108127 description = "description" ,
109128 project_id = ProjectId ("fake_project_id" ),
0 commit comments