예제 #1
0
 def test_ajax_schedule_get_games(self):
     response = self.client.get(self.url)
     json_data = json.loads(response.content)["content"]
     for game_data in json_data["games"]:
         game = Game.objects.get(id=game_data["id"])
         self.assertEquals(game.title, game_data["title"])
         self.assertEquals(game.gm, game_data["gm"])
         self.assertEquals(
             game.location,
             self.lookup(Location, json_data["locations"],
                         game_data["location"]))
         self.assertEquals(
             game.time_block,
             self.lookup(TimeBlock, json_data["blocks"],
                         game_data["time_block"]))
         self.assertEquals(
             game.time_slot,
             self.lookup(TimeSlot, json_data["slots"],
                         game_data["time_slot"]))
         self.assertEquals(get_start(game), game_data["start"])
         self.assertEquals(get_width(game.time_slot), game_data["width"])
예제 #2
0
 def test_get_start_no_block_no_slot(self):
     game = Game()
     self.assertEquals(get_start(game), 100)
예제 #3
0
 def test_get_start_no_slot(self):
     game = Game()
     game.time_block = TimeBlock(text="Friday Night", sort_id=0)
     game.time_slot = None
     self.assertEquals(get_start(game), 100)
예제 #4
0
 def test_get_start_no_block(self):
     game = Game()
     game.time_block = None
     game.time_slot = TimeSlot(start=5, stop=23)
     self.assertEquals(get_start(game), 100)
예제 #5
0
 def test_get_start(self, block, start, expected):
     game = Game()
     game.time_block = TimeBlock(text=block, sort_id=0)
     game.time_slot = TimeSlot(start=start, stop=23)
     self.assertEquals(get_start(game), expected)