示例#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])
示例#2
0
 def test_mission_location_has_missions(self):
     """Locations should have a reference back to related missions."""
     location = Location(name='Smallville')
     location.save()
     mission = Mission(location=location)
     mission.save()
     expected_missions = [mission]
     actual_missions = list(location.missions.all())
     self.assertEqual(expected_missions, actual_missions)
示例#3
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])
示例#4
0
 def test_mission_update_about(self):
     """You should be able to update about for a Mission."""
     mission = Mission()
     about = """
         Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
         do eiusmod tempor incididunt ut labore et dolore magna aliqua.
         Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
         nisi ut aliquip ex ea commodo consequat.
     """
     mission.about = about
     self.assertEqual(about, mission.about)
示例#5
0
文件: lfg.py 项目: dcuolfg/dcuolfg
 def test_mission_has_lfg_requests(self):
     """A Mission should be associated with its LFGRequests."""
     player = make_player()
     toon = Character(
         name='Scarlet Letter', server=0, role=0, powerset=0, player=player)
     toon.save()
     location = Location(name='Someplace')
     location.save()
     mission = Mission(name='FooMissionBar', location=location)
     mission.save()
     lfg = LFGRequest(character=toon, mission=mission)
     lfg.save()
     expected_requests = [lfg]
     actual_requests = list(mission.requests.all())
     self.assertEqual(expected_requests, actual_requests)
示例#6
0
文件: lfg.py 项目: dcuolfg/dcuolfg
 def test_character_has_lfg_requests(self):
     """A Character should be associated with his/her LFGRequests."""
     player = make_player()
     toon = Character(
         name='Duskstrike', server=0, role=0, powerset=0, player=player)
     toon.save()
     location = Location(name='Somewhere')
     location.save()
     mission = Mission(name='FooMission', location=location)
     mission.save()
     lfg = LFGRequest(character=toon, mission=mission)
     lfg.save()
     expected_requests = [lfg]
     actual_requests = list(toon.requests.all())
     self.assertEqual(expected_requests, actual_requests)
示例#7
0
 def test_mission_update_mode(self):
     """You should be able to update the mode of a mission."""
     mission = Mission()
     mission.mode = 1
     self.assertEqual(1, mission.mode)
     self.assertEqual('T1', mission.get_mode_display())
示例#8
0
 def test_mission_update_mission_type(self):
     """You should be able to update a Mission's mission_type."""
     mission = Mission()
     mission.mission_type = 3
     self.assertEqual(3, mission.mission_type)
示例#9
0
 def test_mission_type_default(self):
     """Each mission should start with a default alert type."""
     mission = Mission()
     self.assertEqual(1, mission.mission_type)
     self.assertEqual('Alert', mission.get_mission_type_display())
示例#10
0
 def test_mission_update_featured(self):
     """You should be able to update featured for a Mission."""
     mission = Mission()
     mission.featured = True
     self.assertTrue(mission.featured)
示例#11
0
 def test_mission_update_num_players(self):
     """You should be able to update num_players for a Mission."""
     mission = Mission()
     mission.num_players = 8
     self.assertEqual(8, mission.num_players)
示例#12
0
 def test_mission_num_players_default(self):
     """Mission objects are created for 4 players by default."""
     mission = Mission()
     self.assertEqual(4, mission.num_players)
     self.assertEqual('4', mission.get_num_players_display())