#NEWLINE# @ override_settings ( TEST_SWAPPED_MODEL = 'invalid_models.ReplacementModel' , TEST_SWAPPED_MODEL_BAD_VALUE = 'not-a-model' , TEST_SWAPPED_MODEL_BAD_MODEL = 'not_an_app.Target' ) #NEWLINE# def test_invalid_models( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# module = load_app ( 'modeltests.invalid_models.invalid_models' ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . fail ( 'Unable to load invalid model module' ) #NEWLINE# #UNINDENT# get_validation_errors ( self . stdout , module ) #NEWLINE# self . stdout . seek ( 0 ) #NEWLINE# error_log = self . stdout . read ( ) #NEWLINE# actual = error_log . split ( '\n' ) #NEWLINE# expected = module . model_errors . split ( '\n' ) #NEWLINE# unexpected = [ err for err in actual if ( err not in expected ) ] #NEWLINE# missing = [ err for err in expected if ( err not in actual ) ] #NEWLINE# self . assertFalse ( unexpected , ( 'Unexpected Errors: ' + '\n' . join ( unexpected ) ) ) #NEWLINE# self . assertFalse ( missing , ( 'Missing Errors: ' + '\n' . join ( missing ) ) )