@pytest.mark.django_db
def test_category_links_plugin_show_all(rf):
 category = get_default_category()
 category.status = CategoryStatus.VISIBLE
 category.shops.add(get_default_shop())
 category.save()
 context = get_context(rf)
 plugin = CategoryLinksPlugin({'show_all_categories': False})
 assert context['request'].customer.is_anonymous
 assert (context['request'].shop in category.shops.all())
 assert (not plugin.get_context_data(context)['categories'])
 plugin = CategoryLinksPlugin({'show_all_categories': True})
 assert (category in plugin.get_context_data(context)['categories'])

@ pytest . mark . django_db def test_category_links_plugin_show_all ( rf ) : category = get_default_category ( ) category . status = CategoryStatus . VISIBLE category . shops . add ( get_default_shop ( ) ) category . save ( ) context = get_context ( rf ) plugin = CategoryLinksPlugin ( { 'show_all_categories' : False } ) assert context [ 'request' ] . customer . is_anonymous assert ( context [ 'request' ] . shop in category . shops . all ( ) ) assert ( not plugin . get_context_data ( context ) [ 'categories' ] ) plugin = CategoryLinksPlugin ( { 'show_all_categories' : True } ) assert ( category in plugin . get_context_data ( context ) [ 'categories' ] )
test that show_all_categories forces plugin to return all visible categories .