def test_spotlightify_with_nested_modules(self): parent = ModuleFactory(slug='a-module', order=1) child = ModuleFactory(slug='b-module', order=2, parent=parent) ModuleFactory(slug='c-module', order=3, parent=child) other_child = ModuleFactory(slug='d-module', order=4, parent=parent) spotlightify = parent.spotlightify() assert_that( spotlightify, has_entry( 'modules', contains(child.spotlightify(), other_child.spotlightify())))
def test_spotlightify_with_nested_modules(self): parent = ModuleFactory(slug='a-module', order=1) child = ModuleFactory(slug='b-module', order=2, parent=parent) ModuleFactory( slug='c-module', order=3, parent=child) other_child = ModuleFactory(slug='d-module', order=4, parent=parent) spotlightify = parent.spotlightify() assert_that( spotlightify, has_entry('modules', contains(child.spotlightify(), other_child.spotlightify())) )
def test_spotlightify(self): module = ModuleFactory( slug='a-module', type=self.module_type, dashboard=self.dashboard_a, data_set=self.data_set, order=1, options={ 'foo': 'bar', }, query_parameters={ 'sort_by': 'foo' }) spotlight_module = module.spotlightify() assert_that(spotlight_module['slug'], equal_to('a-module')) assert_that(spotlight_module['foo'], equal_to('bar')) assert_that( spotlight_module['module-type'], equal_to(self.module_type.name)) assert_that( spotlight_module['data-source']['data-group'], equal_to(self.data_group.name)) assert_that( spotlight_module['data-source']['data-type'], equal_to(self.data_type.name)) assert_that( spotlight_module['data-source']['query-params']['sort_by'], equal_to('foo'))
def test_spotlightify_with_no_data_set(self): module = ModuleFactory(slug='a-module', type=self.module_type, dashboard=self.dashboard_a, order=1, options={ 'foo': 'bar', }, query_parameters={'sort_by': 'foo'}) spotlight_module = module.spotlightify() assert_that(spotlight_module['slug'], equal_to('a-module')) assert_that(spotlight_module['foo'], equal_to('bar')) assert_that(spotlight_module['module-type'], equal_to(self.module_type.name)) assert_that(spotlight_module, is_not(has_key('data-source')))
def test_spotlightify_with_a_nested_module(self): section_type = ModuleTypeFactory(name='section') graph_type = ModuleTypeFactory(name='graph') parent = ModuleFactory(type=section_type, slug='a-module', order=1, dashboard=self.dashboard) ModuleFactory(type=graph_type, slug='b-module', order=2, dashboard=self.dashboard, parent=parent) spotlightify = self.dashboard.spotlightify() assert_that(spotlightify, has_entry('modules', contains(parent.spotlightify()))) assert_that(len(spotlightify['modules']), equal_to(1))
def test_spotlightify_with_no_data_set(self): module = ModuleFactory( slug='a-module', type=self.module_type, dashboard=self.dashboard_a, order=1, options={ 'foo': 'bar', }, query_parameters={ 'sort_by': 'foo' }) spotlight_module = module.spotlightify() assert_that(spotlight_module['slug'], equal_to('a-module')) assert_that(spotlight_module['foo'], equal_to('bar')) assert_that( spotlight_module['module-type'], equal_to(self.module_type.name)) assert_that( spotlight_module, is_not(has_key('data-source')))
def test_spotlightify(self): module = ModuleFactory(slug='a-module', type=self.module_type, dashboard=self.dashboard_a, data_set=self.data_set, order=1, options={ 'foo': 'bar', }, query_parameters={'sort_by': 'foo'}) spotlight_module = module.spotlightify() assert_that(spotlight_module['slug'], equal_to('a-module')) assert_that(spotlight_module['foo'], equal_to('bar')) assert_that(spotlight_module['module-type'], equal_to(self.module_type.name)) assert_that(spotlight_module['data-source']['data-group'], equal_to(self.data_group.name)) assert_that(spotlight_module['data-source']['data-type'], equal_to(self.data_type.name)) assert_that(spotlight_module['data-source']['query-params']['sort_by'], equal_to('foo'))
def test_spotlightify_with_a_nested_module(self): section_type = ModuleTypeFactory(name='section') graph_type = ModuleTypeFactory(name='graph') parent = ModuleFactory( type=section_type, slug='a-module', order=1, dashboard=self.dashboard ) ModuleFactory( type=graph_type, slug='b-module', order=2, dashboard=self.dashboard, parent=parent) spotlightify = self.dashboard.spotlightify() assert_that( spotlightify, has_entry('modules', contains(parent.spotlightify())) ) assert_that(len(spotlightify['modules']), equal_to(1))