def test_get_all_orgs(self): """ Test that get_all_orgs returns all orgs from site configuration. """ expected_orgs = [ self.test_config1['course_org_filter'], self.test_config2['course_org_filter'] ] # add SiteConfiguration to database SiteConfigurationFactory.create( site=self.site, site_values=self.test_config1, # TODO: Remove this deprecated value eventually. values=self.test_config1, ) SiteConfigurationFactory.create( site=self.site2, site_values=self.test_config2, # TODO: Remove this deprecated value eventually. values=self.test_config2, ) # Test that the default value is returned if the value for the given key is not found in the configuration six.assertCountEqual(self, SiteConfiguration.get_all_orgs(), expected_orgs)
def get_all_orgs(): """ This returns all of the orgs that are considered in site configurations. This can be used, for example, to do filtering. Returns: 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 return SiteConfiguration.get_all_orgs()
def test_get_all_orgs_returns_only_enabled(self): """ Test that get_all_orgs returns only those orgs whose configurations are enabled. """ expected_orgs = [self.test_config2["course_org_filter"]] # add SiteConfiguration to database SiteConfigurationFactory.create(site=self.site, values=self.test_config1, enabled=False) SiteConfigurationFactory.create(site=self.site2, values=self.test_config2) # 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)
def test_get_all_orgs(self): """ Test that get_all_orgs returns all orgs from site configuration. """ expected_orgs = [self.test_config1["course_org_filter"], self.test_config2["course_org_filter"]] # add SiteConfiguration to database SiteConfigurationFactory.create(site=self.site, values=self.test_config1) SiteConfigurationFactory.create(site=self.site2, values=self.test_config2) # 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)
def get_all_orgs(): """ This returns all of the orgs that are considered in site configurations or microsite configuration, This can be used, for example, to do filtering. Returns: A list of all organizations present in either microsite configuration or site configuration. """ site_configuration_orgs = SiteConfiguration.get_all_orgs() microsite_orgs = microsite.get_all_orgs() return site_configuration_orgs.union(microsite_orgs)
def get_all_orgs(): """ This returns all of the orgs that are considered in site configurations or microsite configuration, This can be used, for example, to do filtering. Returns: A list of all organizations present in either microsite configuration or site configuration. """ site_configuration_orgs = SiteConfiguration.get_all_orgs() microsite_orgs = microsite.get_all_orgs() return site_configuration_orgs.union(microsite_orgs)
def get_all_orgs(): """ This returns all of the orgs that are considered in site configurations or microsite configuration, This can be used, for example, to do filtering. Returns: A list of all organizations present in either microsite configuration or site configuration. """ # Import is placed here to avoid model import at project startup. from openedx.core.djangoapps.site_configuration.models import SiteConfiguration site_configuration_orgs = SiteConfiguration.get_all_orgs() microsite_orgs = microsite.get_all_orgs() return site_configuration_orgs.union(microsite_orgs)
def get_all_orgs(): """ This returns all of the orgs that are considered in site configurations or microsite configuration, This can be used, for example, to do filtering. Returns: A list of all organizations present in either microsite configuration or site configuration. """ # Import is placed here to avoid model import at project startup. from openedx.core.djangoapps.site_configuration.models import SiteConfiguration site_configuration_orgs = SiteConfiguration.get_all_orgs() microsite_orgs = microsite.get_all_orgs() return site_configuration_orgs.union(microsite_orgs)
def test_get_all_orgs_returns_only_enabled(self): """ Test that get_all_orgs returns only those orgs whose configurations are enabled. """ expected_orgs = [self.test_config2['course_org_filter']] # add SiteConfiguration to database SiteConfigurationFactory.create( site=self.site, site_values=self.test_config1, enabled=False, ) SiteConfigurationFactory.create(site=self.site2, site_values=self.test_config2) # Test that the default value is returned if the value for the given key is not found in the configuration six.assertCountEqual(self, SiteConfiguration.get_all_orgs(), expected_orgs)
def test_get_all_orgs(self): """ Test that get_all_orgs returns all orgs from site configuration. """ expected_orgs = [ self.test_config1['course_org_filter'], self.test_config2['course_org_filter'] ] # add SiteConfiguration to database SiteConfigurationFactory.create( site=self.site, values=self.test_config1, ) SiteConfigurationFactory.create( site=self.site2, values=self.test_config2, ) # 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, )