@@ -224,6 +224,22 @@ def test_find_tool_by_full_name_should_succeed3(self):
224224 self .assertEqual (found_tool .name , tool1 .name )
225225 self .assertIsNone (found_tool .company )
226226
227+ def test_find_tool_by_full_name_should_succeed4 (self ):
228+
229+ # arrange
230+ ValidationModelsTestCase .set_user_context ()
231+ tool1 = AuthoringTool .objects .create (name = 'MyFabTool' , version = '1.0' )
232+
233+ # act
234+ name_to_find = 'MyFabTool - 1.0'
235+ found_tool = AuthoringTool .find_by_full_name (name_to_find )
236+
237+ # assert
238+ self .assertIsNotNone (found_tool )
239+ self .assertIsInstance (found_tool , AuthoringTool )
240+ self .assertEqual (found_tool .name , tool1 .name )
241+ self .assertIsNone (found_tool .company )
242+
227243 def test_find_tool_by_full_name_should_return_none (self ):
228244
229245 # arrange
@@ -248,6 +264,18 @@ def test_add_tool_twice_should_fail(self):
248264 with self .assertRaises (IntegrityError ):
249265 AuthoringTool .objects .create (name = 'Test Application' , version = '0.11' ) # should fail
250266
267+ def test_add_tool_with_company_twice_should_fail (self ):
268+
269+ # arrange
270+ ValidationModelsTestCase .set_user_context ()
271+
272+ # act/assert
273+ company , _ = Company .objects .get_or_create (name = 'Acme Inc.' )
274+ AuthoringTool .objects .create (name = 'Test Application' , version = '0.10' , company = company ) # should succeed
275+ AuthoringTool .objects .create (name = 'Test Application' , version = '0.11' , company = company ) # should succeed
276+ with self .assertRaises (IntegrityError ):
277+ AuthoringTool .objects .create (name = 'Test Application' , version = '0.11' , company = company ) # should fail
278+
251279 def test_model_can_navigate_back_to_request (self ):
252280
253281 # arrange
@@ -305,4 +333,3 @@ def test_task_can_navigate_back_to_model(self):
305333 # assert
306334 self .assertIsNotNone (retrieved_task )
307335 self .assertEqual (model .id , model_id )
308-
0 commit comments