Skip to content

Commit

Permalink
Fix test: gather sections through session
Browse files Browse the repository at this point in the history
  • Loading branch information
Evert-R committed Dec 19, 2024
1 parent 398d7bf commit 7bd85db
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions backend/experiment/rules/tests/test_categorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,24 @@ def test_plan_experiment_and_phase(self):
self.assertEqual(self.session.json_data.get('phase'), 'training-1A')

# Test section sequence training phase
if self.session.json_data.get('group') == 'C1':
sections = Section.objects.filter(group="CROSSED", tag__contains="1", song__artist__contains="Training")
if self.session.json_data.get('group') == 'S1':
sections = self.session.playlist.section_set.filter(
group="SAME", tag__contains="1", song__artist__contains="Training")
for section in sections:
self.assertIn(section.id, self.session.json_data.get('sequence'))
if self.session.json_data.get('group') == 'C2':
sections = Section.objects.filter(group="CROSSED", tag__contains="2", song__artist__contains="Training")
if self.session.json_data.get('group') == 'S2':
sections = self.session.playlist.section_set.filter(
group="SAME", tag__contains="2", song__artist__contains="Training")
for section in sections:
self.assertIn(section.id, self.session.json_data.get('sequence'))

if self.session.json_data.get('group') == 'S1':
sections = Section.objects.filter(group="SAME", tag__contains="1", song__artist__contains="Training")
if self.session.json_data.get('group') == 'C1':
sections = self.session.playlist.section_set.filter(
group="CROSSED", tag__contains="1", song__artist__contains="Training")
for section in sections:
self.assertIn(section.id, self.session.json_data.get('sequence'))
if self.session.json_data.get('group') == 'S2':
sections = Section.objects.filter(group="SAME", tag__contains="2", song__artist__contains="Training")
if self.session.json_data.get('group') == 'C2':
sections = self.session.playlist.section_set.filter(
group="CROSSED", tag__contains="2", song__artist__contains="Training")
for section in sections:
self.assertIn(section.id, self.session.json_data.get('sequence'))

0 comments on commit 7bd85db

Please sign in to comment.