Beispiel #1
0
 def test_get_players_diets(self):
     # Initialize
     larp = create_all_1_group()
     assigments = larp.get_character_assigments()
     number_of_runs = get_runs_number(assigments)
     # Obtain results
     players_diets_all_runs = get_players_diets(assigments, number_of_runs)
     # Validate
     self.assertEqual(len(players_diets_all_runs), number_of_runs)
     for players_diets in players_diets_all_runs:
         self.assertEqual(len(players_diets), 2)
         for player_diet in players_diets:
             test_character_diets(test=self, original_list=example_players_with_diets1,returned_info=player_diet)
Beispiel #2
0
 def test_get_diets_amounts_no_diets(self):
     # Initialize
     larp = create_all_without_profiles()
     assigments = larp.get_character_assigments()
     number_of_runs = 1
     # Obtain results
     assigments = larp.get_character_assigments()
     number_of_runs = get_runs_number(assigments)
     players_diets = get_players_diets(assigments, number_of_runs)
     diets_types = DietaryRestriction.objects.all()
     all_runs_diets = get_diets_amounts(players_diets, number_of_runs, diets_types)
     # Validate
     self.assertIs(len(all_runs_diets), 1)
     for run_diets in all_runs_diets:
         self.assertEqual(run_diets, [])
Beispiel #3
0
 def test_get_diets_amounts_empty(self):
     # Initialize
     create_diets()
     larp = create_all_without_profiles()
     assigments = larp.get_character_assigments()
     number_of_runs = 1
     # Obtain results
     assigments = larp.get_character_assigments()
     number_of_runs = get_runs_number(assigments)
     players_diets = get_players_diets(assigments, number_of_runs)
     diets_types = DietaryRestriction.objects.all()
     all_runs_diets = get_diets_amounts(players_diets, number_of_runs, diets_types)
     # Validate
     self.assertIs(len(all_runs_diets), 1)
     for run_diets in all_runs_diets:
         for diet in run_diets:
             diet_name = diet["diet_name"]
             self.assertIs(diet["amount"], 0)
Beispiel #4
0
 def test_get_diets_amounts(self):
     # Initialize
     larp = create_all_2_groups()
     # Obtain results
     assigments = larp.get_character_assigments()
     number_of_runs = get_runs_number(assigments)
     players_diets = get_players_diets(assigments, number_of_runs)
     diets_types = DietaryRestriction.objects.all()
     all_runs_diets = get_diets_amounts(players_diets, number_of_runs, diets_types)
     # Validate
     self.assertIs(len(all_runs_diets), 2)
     run = 0
     for run_diets in all_runs_diets:
         for diet in run_diets:
             diet_name = diet["diet_name"]
             example_amount = example_diets_counts[run][diet_name]
             self.assertIs(diet["amount"], example_amount)
         run += 1
Beispiel #5
0
 def test_get_runs_number(self):
     larp = create_all_1_group()
     assigments = larp.get_character_assigments()
     runs_number = get_runs_number(assigments)
     self.assertIs(runs_number, 2)