def sharing_box(context): request = context['request'] services = sharing.get_services() c = dict(context.items()) c.update({'request': request, 'user': request.user, 'services': services}) return c
def sharing_widget(context, obj, condensed=False): c = dict(context.items()) services = sharing.get_services() c.update({ 'condensed': condensed, 'services': services, 'obj': obj, }) return c
def sharing_box(context): request = context['request'] services = sharing.get_services() c = dict(context.items()) c.update({ 'request': request, 'user': request.user, 'services': services }) return c
def test_get_services_in_ja_locale(): testo = sharing.LOCALSERVICE1 testo.shortname = 'translated-localservice1' expected = [ 'digg', 'facebook', 'delicious', 'myspace', 'friendfeed', 'twitter', 'translated-localservice1' ] with patch.object(sharing, 'LOCALSERVICE1', testo): tower.activate('ja') assert expected == [s.shortname for s in sharing.get_services()]
def test_get_services_in_ja_locale(): testo = sharing.LOCALSERVICE1 testo.shortname = 'translated-localservice1' expected = [ 'digg', 'facebook', 'delicious', 'myspace', 'friendfeed', 'twitter', 'translated-localservice1'] with patch.object(sharing, 'LOCALSERVICE1', testo): tower.activate('ja') assert expected == [s.shortname for s in sharing.get_services()]
def test_get_services_in_ja_locale(): testo = sharing.LOCALSERVICE1 testo.shortname = 'translated-localservice1' expected = [ 'facebook', 'twitter', 'gplus', 'Reddit', 'Tumblr', 'translated-localservice1' ] with patch.object(sharing, 'LOCALSERVICE1', testo): old_locale = translation.get_language() try: tower.activate('ja') assert expected == [s.shortname for s in sharing.get_services()] finally: tower.activate(old_locale)
def sharing_widget(context, obj, condensed=False): c = dict(context.items()) services = sharing.get_services() counts = {} for service in services: short = encoding.smart_str(service.shortname) counts[short] = service.count_term(obj.share_counts[short]) c.update({ 'condensed': condensed, 'base_url': obj.share_url(), 'counts': counts, 'services': services, 'obj': obj, }) return c
def test_get_services_in_ja_locale(): testo = sharing.LOCALSERVICE1 testo.shortname = 'translated-localservice1' expected = [ 'facebook', 'twitter', 'gplus', 'Reddit', 'Tumblr', 'translated-localservice1'] with patch.object(sharing, 'LOCALSERVICE1', testo): old_locale = translation.get_language() try: tower.activate('ja') assert expected == [s.shortname for s in sharing.get_services()] finally: tower.activate(old_locale)
def test_get_services_in_en_locale(): # The order is the same as the order of sharing.SERVICES_LIST l = ['digg', 'facebook', 'delicious', 'myspace', 'friendfeed', 'twitter'] assert l == [s.shortname for s in sharing.get_services()]
def test_get_services_in_en_locale(): # The order is the same as the order of sharing.SERVICES_LIST l = ['facebook', 'twitter', 'gplus', 'Reddit', 'Tumblr'] assert l == [s.shortname for s in sharing.get_services()]