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)
def test_mission_location_update_image(self): """Locations should be able to specify an image. This test is for completeness sake. Most of this is hidden away behind the model, admin, or form interactions. """ location = Location() img = models.ImageField('location_image.png') location.image = img self.assertEqual(img, location.image)
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)
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)