Skip to content

Commit

Permalink
test: verifing test cases 25
Browse files Browse the repository at this point in the history
  • Loading branch information
mfarhan943 committed Sep 23, 2024
1 parent 9847ad1 commit 22d7b41
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ jobs:
- "lms-6"
- "openedx-1-with-lms"
- "openedx-2-with-lms"
# - "openedx-1-with-cms"
# - "openedx-2-with-cms"
- "openedx-1-with-cms"
- "openedx-2-with-cms"
- "cms-1"
- "cms-2"
- "common-with-lms"
# - "common-with-cms"
- "common-with-cms"
- "xmodule-with-lms"
# - "xmodule-with-cms"
- "xmodule-with-cms"
mongo-version:
- "7.0"

Expand Down
26 changes: 14 additions & 12 deletions openedx/core/djangoapps/user_api/preferences/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test.utils import override_settings
from django.urls import reverse
from pytz import common_timezones, utc
from zoneinfo import ZoneInfo
from zoneinfo import ZoneInfo, available_timezones

from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
from openedx.core.lib.time_zone_utils import get_display_time_zone
Expand Down Expand Up @@ -402,23 +401,26 @@ class CountryTimeZoneTest(CacheIsolationTestCase):
"""

@ddt.data(('ES', ['Africa/Ceuta', 'Atlantic/Canary', 'Europe/Madrid']),
(None, common_timezones[:10]),
('AA', common_timezones[:10]))
(None, available_timezones()),
('AA', available_timezones()))
@ddt.unpack
def test_get_country_time_zones(self, country_code, expected_time_zones):
"""
Verify that list of common country time zones dictionaries is returned
An unrecognized country code (e.g. AA) will return the list of common timezones
"""
expected_dict = [
{
'time_zone': time_zone,
'description': get_display_time_zone(time_zone)
}
for time_zone in expected_time_zones
]
expected_dict = sorted(
[
{
'time_zone': time_zone_name,
'description': get_display_time_zone(time_zone_name),
}
for time_zone_name in expected_time_zones
],
key=lambda tz_dict: tz_dict['description']
)
country_time_zones_dicts = get_country_time_zones(country_code)[:10]
assert country_time_zones_dicts == expected_dict
assert country_time_zones_dicts == expected_dict[:10]


def get_expected_validation_developer_message(preference_key, preference_value):
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_api/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def _assert_time_zone_is_valid(self, time_zone_info):
assert time_zone_info['description'] == get_display_time_zone(time_zone_name)

# The time zones count may need to change each time we upgrade pytz
@ddt.data((ALL_TIME_ZONES_URI, 433),
@ddt.data((ALL_TIME_ZONES_URI, 611),
(COUNTRY_TIME_ZONES_URI, 23))
@ddt.unpack
def test_get_basic(self, country_uri, expected_count):
Expand Down

0 comments on commit 22d7b41

Please sign in to comment.