get_all_orgs returns a set, not a list. BOM-731

This commit is contained in:
Ned Batchelder
2019-09-18 13:42:55 -04:00
parent 1e4fac6440
commit b027437e80
4 changed files with 8 additions and 13 deletions

View File

@@ -210,7 +210,7 @@ def get_all_orgs():
This can be used, for example, to do filtering.
Returns:
A list of all organizations present in the site configuration.
A set of all organizations present in the site configuration.
"""
# Import is placed here to avoid model import at project startup.
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration

View File

@@ -114,7 +114,7 @@ class SiteConfiguration(models.Model):
for example, to do filtering.
Returns:
A list of all organizations present in site configuration.
A set of all organizations present in site configuration.
"""
org_filter_set = set()

View File

@@ -4,6 +4,7 @@ Tests for site configuration's django models.
from __future__ import absolute_import
from mock import patch
import six
from django.test import TestCase
from django.db import IntegrityError, transaction
@@ -321,10 +322,7 @@ class SiteConfigurationTests(TestCase):
)
# Test that the default value is returned if the value for the given key is not found in the configuration
self.assertListEqual(
list(SiteConfiguration.get_all_orgs()),
expected_orgs,
)
six.assertCountEqual(self, SiteConfiguration.get_all_orgs(), expected_orgs)
def test_get_all_orgs_returns_only_enabled(self):
"""
@@ -343,7 +341,4 @@ class SiteConfigurationTests(TestCase):
)
# Test that the default value is returned if the value for the given key is not found in the configuration
self.assertListEqual(
list(SiteConfiguration.get_all_orgs()),
expected_orgs,
)
six.assertCountEqual(self, SiteConfiguration.get_all_orgs(), expected_orgs)