Exemplo n.º 1
0
 def test_mission_nick_name_required(self):
     """You should not be able to create a Mission without a nick_name."""
     mission = Mission()
     with self.assertRaises(ValidationError) as err:
         mission.full_clean()
     expected_message = 'This field cannot be blank.'
     message_list = err.exception.message_dict.get('nick_name')
     self.assertEqual(expected_message, message_list[0])
Exemplo n.º 2
0
 def test_mission_num_players_possible(self):
     """You should not be able to specify arbitrary num_players."""
     mission = Mission()
     mission.num_players = 33
     with self.assertRaises(ValidationError) as err:
         mission.full_clean()
     expected_message = 'Value 33 is not a valid choice.'
     message_list = err.exception.message_dict.get('num_players')
     self.assertEqual(expected_message, message_list[0])