Skip to content

Commit

Permalink
fix: address testing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Feb 23, 2024
1 parent 19ef17e commit 37bf55e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
5 changes: 4 additions & 1 deletion cms/djangoapps/models/settings/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ class TeamsConfigurationTests(unittest.TestCase):
(config_block_no_global_max_team_size, set()),
(config_block_course_max_team_size, {'max_team_size cannot be greater than 500'}),
(config_block_teamset_max_team_size, {'max_team_size cannot be greater than 500'}),
(config_block_invalid_dynamic_partition_ids, {'dynamic_user_partition_id must be greater or equal than 51 and less than 100.'})
(
config_block_invalid_dynamic_partition_ids,
{'dynamic_user_partition_id must be greater or equal than 51 and less than 100.'}
)
)
@ddt.unpack
def test_team_settings(self, config_block, error_message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import logging
from datetime import datetime
from typing import Dict, List
from typing import Dict

from opaque_keys.edx.keys import CourseKey

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
from opaque_keys.edx.locator import LibraryLocator
import attr
import ddt
from openedx.core.djangoapps.content.learning_sequences.api.processors.team_partition_groups import TeamPartitionGroupsOutlineProcessor
from lms.djangoapps.teams.tests.factories import CourseTeamFactory
from openedx.core.djangoapps.content.learning_sequences.api.processors.team_partition_groups import (
TeamPartitionGroupsOutlineProcessor,
)
from openedx.core.djangolib.testing.utils import skip_unless_lms
import pytest

Expand Down Expand Up @@ -2032,7 +2035,7 @@ def setUpTestData(cls):
groups.
- A student enrolled in the course and added to one of the teams.
"""
from lms.djangoapps.teams.tests.factories import CourseTeamFactory, CourseTeamMembershipFactory
super().setUpTestData()
cls.visibility = VisibilityData(
hide_from_toc=False,
visible_to_staff_only=False
Expand Down Expand Up @@ -2119,7 +2122,8 @@ def test_load_data_in_partition_processor(self, team_sets_mock, team_configurati
@patch("openedx.core.djangoapps.course_groups.partition_generator.get_team_sets")
def test_user_not_excluded_by_partition_group(self, team_sets_mock, team_configuration_service_mock):
"""
Test that the team partition groups processor correctly determines if a user is excluded by the partition groups.
Test that the team partition groups processor correctly determines if a user is excluded by the partition
groups.
Expected result:
- The user should not be excluded by the partition groups meaning the method should return False.
Expand All @@ -2136,14 +2140,18 @@ def test_user_not_excluded_by_partition_group(self, team_sets_mock, team_configu
}
team_partition_groups_processor.load_data(self.outline)

assert not team_partition_groups_processor._is_user_excluded_by_partition_group(sequence_partition_groups)
# pylint: disable=protected-access
assert not team_partition_groups_processor._is_user_excluded_by_partition_group(
sequence_partition_groups
)
assert not team_partition_groups_processor._is_user_excluded_by_partition_group([])

@patch("openedx.core.djangoapps.course_groups.team_partition_scheme.TeamsConfigurationService")
@patch("openedx.core.djangoapps.course_groups.partition_generator.get_team_sets")
def test_user_excluded_by_partition_group(self, team_sets_mock, team_configuration_service_mock):
"""
Test that the team partition groups processor correctly determines if a user is excluded by the partition groups.
Test that the team partition groups processor correctly determines if a user is excluded by the partition
groups.
Expected result:
- The user should not be excluded by the partition groups meaning the method should return False.
Expand All @@ -2159,6 +2167,7 @@ def test_user_excluded_by_partition_group(self, team_sets_mock, team_configurati
}
team_partition_groups_processor.load_data(self.outline)

# pylint: disable=protected-access
assert team_partition_groups_processor._is_user_excluded_by_partition_group(sequence_partition_groups)

@patch("openedx.core.djangoapps.course_groups.team_partition_scheme.TeamsConfigurationService")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@


class TeamUserPartition(UserPartition):
"""Extends UserPartition to support dynamic gcreate_team_set_partition_with_course_idroups pulled from the current course teams.
"""Extends UserPartition to support dynamic gcreate_team_set_partition_with_course_idroups pulled from the current
course teams.
Class attributes:
team_sets_mapping (dict): A mapping of partition IDs to team-set IDs.
Expand Down
1 change: 0 additions & 1 deletion openedx/core/lib/teams_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from django.utils.functional import cached_property

from openedx.core.djangoapps.course_groups.flags import CONTENT_GROUPS_FOR_TEAMS

# "Arbitrarily large" but still limited
MANAGED_TEAM_MAX_TEAM_SIZE = 200
Expand Down

0 comments on commit 37bf55e

Please sign in to comment.