self.session = {} self.browser_id = browser_id class NotAuthenticatedUser: def __init__(self): self.session = {} def is_authenticated(self): return False def is_anonymous(self): return True rpc = Rpc() class TestRpcView(TestCase): def test_views(self): #UnicodeEncodeError: 500 status data = {'русский': '{}'} response = self.client.post( reverse('widget:rpc', args=['show_widget']), data) #broken json: 500 status data = {'param': '{broken - json "'} response = self.client.post( reverse('widget:rpc', args=['show_widget']), data) #call private method response = self.client.get(
from django.utils.translation import ugettext_lazy as _ from django.views.decorators.csrf import csrf_exempt from django.views.decorators.clickjacking import xframe_options_exempt import widget from auth.models import CustomUser from teams.models import Task from teams.permissions import get_member from utils import DEFAULT_PROTOCOL from utils.decorators import staff_member_required from videos import models from widget.models import SubtitlingSession from widget.null_rpc import NullRpc from widget.rpc import add_general_settings, Rpc rpc_views = Rpc() null_rpc_views = NullRpc() @xframe_options_exempt def embedder_widget(request, analytics): """ This serves the new embedder. """ return render(request, 'embedder-widget.html', { 'noanalytics': analytics == "noanalytics/", }) def embed(request, version_no=''): """