text stringlengths 0 1.05M | meta dict |
|---|---|
from django.template.loader import render_to_string
from modules.module_utils import ModuleLibrary
from ..models import Song
register = ModuleLibrary()
@register.module
class ModMusicNode(object):
module_name = 'mod_music'
def render(self, context):
if Song.objects.filter(nowplaying=True).count() ... | {
"repo_name": "Mause/pyalp",
"path": "pyalp/apps/music/modules/mod_music.py",
"copies": "1",
"size": "1473",
"license": "mit",
"hash": 509273634754348800,
"line_mean": 23.9661016949,
"line_max": 64,
"alpha_frac": 0.5179904956,
"autogenerated": false,
"ratio": 4.383928571428571,
"config_test": f... |
from django.template.loader import render_to_string
from amon.apps.notifications.mail.sender import _send_email
from django.conf import settings
def send_invitation_email(invite):
if invite:
recipients_list = [invite['email']]
subject = 'You have been invited to join Amon.'
... | {
"repo_name": "martinrusev/amonone",
"path": "amon/apps/users/emails.py",
"copies": "2",
"size": "1058",
"license": "mit",
"hash": 7087339561185361000,
"line_mean": 25.8947368421,
"line_max": 78,
"alpha_frac": 0.5756143667,
"autogenerated": false,
"ratio": 4.1328125,
"config_test": false,
"ha... |
from django.template.loader import render_to_string
from courant.core.mailer.models import MessageJob
try:
from apps.email_subscriptions.models import EmailSubscription
except:
pass
from courant.core.profiles.models import UserProfile
from models import *
def send_email_update(subject, from_address, from_... | {
"repo_name": "maxcutler/Courant-News",
"path": "courant/core/news/notifications.py",
"copies": "1",
"size": "1092",
"license": "bsd-3-clause",
"hash": 8997640019940497000,
"line_mean": 40,
"line_max": 104,
"alpha_frac": 0.6721611722,
"autogenerated": false,
"ratio": 3.831578947368421,
"config_... |
from django.template.loader import render_to_string
import settings
from xformmanager.models import FormDefModel, Metadata
from receiver.models import Submission, Attachment
from hq.models import BlacklistedUser
def domain_summary(request, domain=None, detail_view=True):
'''Domain Admin Summary Data'''... | {
"repo_name": "commtrack/temp-aquatest",
"path": "apps/reports/custom/all/domain_summary.py",
"copies": "1",
"size": "3594",
"license": "bsd-3-clause",
"hash": 2378532772986045400,
"line_mean": 42.3950617284,
"line_max": 110,
"alpha_frac": 0.5447968837,
"autogenerated": false,
"ratio": 4.14055299... |
from django.template.loader import render_to_string
import settings
from xformmanager.models import Metadata
from hq.utils import paginate, get_table_display_properties, get_query_set
def metadata(request, domain=None):
'''Submission Summary List for All Forms'''
if not domain:
domain = ... | {
"repo_name": "commtrack/temp-aquatest",
"path": "apps/reports/custom/all/metadata.py",
"copies": "1",
"size": "1389",
"license": "bsd-3-clause",
"hash": 2696142526921334000,
"line_mean": 40.0909090909,
"line_max": 110,
"alpha_frac": 0.5615550756,
"autogenerated": false,
"ratio": 4.340625,
"con... |
from django.template.loader import select_template, get_template, find_template
def push_context(context,indices = ["generic_object","object","generic_object_list"]):
save = {}
for i in indices:
save[i] = context.get(i)
return save
def pop_context(context,save):
for i in save.keys():
c... | {
"repo_name": "Krozark/Kraggne",
"path": "Kraggne/contrib/flatblocks/utils.py",
"copies": "3",
"size": "3587",
"license": "bsd-2-clause",
"hash": -7282013668909984000,
"line_mean": 33.8252427184,
"line_max": 165,
"alpha_frac": 0.6788402565,
"autogenerated": false,
"ratio": 3.5097847358121332,
"... |
from django.template.loader import select_template
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from django.utils.module_loading import import_string
from entangled.forms import EntangledModelFormMixin
from cms.plugin_pool import plugin_pool
from cmsplugin_cascade.lin... | {
"repo_name": "awesto/django-shop",
"path": "shop/cascade/auth.py",
"copies": "1",
"size": "3861",
"license": "bsd-3-clause",
"hash": -1412889286246807000,
"line_mean": 39.6421052632,
"line_max": 110,
"alpha_frac": 0.6397306397,
"autogenerated": false,
"ratio": 4.021875,
"config_test": false,
... |
from django.template.loader import select_template
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from django.utils.module_loading import import_string
from entangled.forms import EntangledModelFormMixin
from cms.plugin_pool import plugin_pool
from cmsplugin_cascade.li... | {
"repo_name": "divio/django-shop",
"path": "shop/cascade/auth.py",
"copies": "1",
"size": "3871",
"license": "bsd-3-clause",
"hash": -9149513745726260000,
"line_mean": 39.7473684211,
"line_max": 110,
"alpha_frac": 0.6411779902,
"autogenerated": false,
"ratio": 4.023908523908524,
"config_test": ... |
from django.template.loader import select_template
from django.utils import translation
from django_elasticsearch_dsl import fields, Document, Index
from elasticsearch.exceptions import NotFoundError
from shop.conf import app_settings
from shop.models.product import ProductModel
from shop.search.analyzers import body... | {
"repo_name": "awesto/django-shop",
"path": "shop/search/documents.py",
"copies": "1",
"size": "4087",
"license": "bsd-3-clause",
"hash": 6879606290700315000,
"line_mean": 37.9238095238,
"line_max": 100,
"alpha_frac": 0.6322485931,
"autogenerated": false,
"ratio": 4.2396265560165975,
"config_te... |
from django.template.loader import select_template
import os
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
import models
from .conf import settings
from filer.settings import FILER_STATICMEDIA_PREFIX
class FilerImagePlugin(CMS... | {
"repo_name": "jrief/cmsplugin-filer",
"path": "cmsplugin_filer_image/cms_plugins.py",
"copies": "1",
"size": "5198",
"license": "bsd-3-clause",
"hash": 4751809362420696000,
"line_mean": 39.609375,
"line_max": 112,
"alpha_frac": 0.5781069642,
"autogenerated": false,
"ratio": 4.563652326602282,
... |
from django.template.loaders.filesystem import load_template_source as django_load_template_source
from django.conf import settings
def load_template_source(templateName, templateDirs=None):
if not templateDirs:
templateDirs = list(settings.TEMPLATE_DIRS)
parts = templateName.split(":")
i... | {
"repo_name": "Royce/GammaJS",
"path": "support/web/main/templates.py",
"copies": "1",
"size": "1101",
"license": "mit",
"hash": 3503968134398420000,
"line_mean": 29.5833333333,
"line_max": 98,
"alpha_frac": 0.5858310627,
"autogenerated": false,
"ratio": 4.386454183266932,
"config_test": false,... |
from django.template.loaders import app_directories, filesystem
from django.template.base import TemplateDoesNotExist
from django.template.loader import make_origin
from django.conf import settings
from rhinocloud.template.openoffice import OpenOfficeTemplate
import zipfile
def read_openoffice(filepath):
files =... | {
"repo_name": "allanlei/rhinocloud-utils",
"path": "rhinocloud/template/loaders/openoffice.py",
"copies": "1",
"size": "2473",
"license": "bsd-3-clause",
"hash": 448340756645303400,
"line_mean": 40.2166666667,
"line_max": 117,
"alpha_frac": 0.6304084108,
"autogenerated": false,
"ratio": 4.7557692... |
from django.template.loader_tags import BlockNode, ExtendsNode
from django.template import loader, Context, RequestContext
def _get_template(template):
if isinstance(template, (tuple, list)):
return loader.select_template(template)
return loader.get_template(template)
class BlockNotFound(Exception):
... | {
"repo_name": "alexhayes/django-templated-email",
"path": "templated_email/block_render.py",
"copies": "1",
"size": "2748",
"license": "mit",
"hash": 7678970284264856000,
"line_mean": 31.3294117647,
"line_max": 78,
"alpha_frac": 0.6113537118,
"autogenerated": false,
"ratio": 4.587646076794658,
... |
from django.template.loader_tags import BlockNode, ExtendsNode
from django.template import loader, Context, RequestContext, TextNode
def get_template(template):
if isinstance(template, (tuple, list)):
return loader.select_template(template)
return loader.get_template(template)
class BlockNotFo... | {
"repo_name": "wdamon/tenants_talk",
"path": "contest/snippets/942.py",
"copies": "1",
"size": "2531",
"license": "mit",
"hash": 1328184923581461000,
"line_mean": 36.3484848485,
"line_max": 100,
"alpha_frac": 0.6408534176,
"autogenerated": false,
"ratio": 4.409407665505227,
"config_test": false... |
from django.template.loader_tags import ExtendsNode
from django.conf import settings
import re
def recursive_block_replace(template, data=None, replace_static_url=True, replace_trans=True,
replace_with=True, replace_if=True):
#check the extends
# first try to replace with current da... | {
"repo_name": "philippWassibauer/templated-emails",
"path": "templated_emails/parse_util.py",
"copies": "1",
"size": "3272",
"license": "mit",
"hash": 6472577623443375000,
"line_mean": 35.3555555556,
"line_max": 116,
"alpha_frac": 0.5822127139,
"autogenerated": false,
"ratio": 3.477151965993624,
... |
from django.template.loader_tags import register
from django.template import loader, Context, defaultfilters, TemplateDoesNotExist
import markdown
presenters = {
'Speaker': 'presenters/speaker_presenter.html'
}
generic_template = 'presenters/object_presenter.html'
@register.simple_tag(takes_context=True)
def p... | {
"repo_name": "pyconca/2017-web",
"path": "pyconca2017/pycon_sponsors/templatetags/presenters.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": -7185255769870906000,
"line_mean": 24.2727272727,
"line_max": 90,
"alpha_frac": 0.6924460432,
"autogenerated": false,
"ratio": 3.782312925170... |
from django.template.loader_tags import register
from django.utils.translation import ugettext as _
#from pytz import timezone
from django.utils.timezone import timedelta
import socket
@register.simple_tag()
def print_event(event):
def _descr(e):
s1 = e.lead
s2 = _(" Eventet finns på: www.i-portale... | {
"repo_name": "I-sektionen/i-portalen",
"path": "wsgi/iportalen_django/events/templatetags/feed_tags.py",
"copies": "1",
"size": "1687",
"license": "mit",
"hash": 664787323573787400,
"line_mean": 43.3684210526,
"line_max": 112,
"alpha_frac": 0.59371293,
"autogenerated": false,
"ratio": 3.63362068... |
from django.template.response import SimpleTemplateResponse
from django.test import TestCase, RequestFactory
from ..apps.pages.models import Country
from ..middleware import PublicationMiddleware, LocalisationMiddleware
class MiddlewareTest(TestCase):
def setUp(self):
self.factory = RequestFactory()
... | {
"repo_name": "dan-gamble/cms",
"path": "cms/tests/test_middleware.py",
"copies": "1",
"size": "5237",
"license": "bsd-3-clause",
"hash": 5050466710196856000,
"line_mean": 37.7925925926,
"line_max": 93,
"alpha_frac": 0.6835974795,
"autogenerated": false,
"ratio": 4.408249158249158,
"config_test... |
from django.template.response import SimpleTemplateResponse
from django.utils.translation import gettext_lazy as _
from debug_toolbar.panels import Panel
class RedirectsPanel(Panel):
"""
Panel that intercepts redirects and displays a page with debug info.
"""
has_content = False
nav_title = _("... | {
"repo_name": "django-debug-toolbar/django-debug-toolbar",
"path": "debug_toolbar/panels/redirects.py",
"copies": "1",
"size": "1144",
"license": "bsd-3-clause",
"hash": -8345302751942576000,
"line_mean": 34.75,
"line_max": 88,
"alpha_frac": 0.6005244755,
"autogenerated": false,
"ratio": 5.039647... |
from django.template.response import TemplateResponse
from django.contrib import messages
from django.http import HttpResponseForbidden
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from django.contrib.auth.decorators import login_requir... | {
"repo_name": "jacobjbollinger/sorbet",
"path": "sorbet/core/views.py",
"copies": "1",
"size": "3859",
"license": "bsd-2-clause",
"hash": -247103245645373340,
"line_mean": 43.8720930233,
"line_max": 139,
"alpha_frac": 0.6548328583,
"autogenerated": false,
"ratio": 4.390216154721275,
"config_tes... |
from django.template.response import TemplateResponse
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
import md5
from bs4 import BeautifulSoup
from urllib2 import urlopen
from urlpar... | {
"repo_name": "jacobjbollinger/sorbet",
"path": "sorbet/feedmanager/views.py",
"copies": "1",
"size": "2514",
"license": "bsd-2-clause",
"hash": -975363582969936300,
"line_mean": 31.2307692308,
"line_max": 114,
"alpha_frac": 0.6710421639,
"autogenerated": false,
"ratio": 4.169154228855722,
"con... |
from django.template.response import TemplateResponse
from django.core.mail import EmailMessage
from django.contrib import messages
from django import forms
from captcha.fields import CaptchaField
class CaptchaTestForm(forms.Form):
captcha = CaptchaField()
def home(request):
if request.method == 'PO... | {
"repo_name": "arbin/pysoldev",
"path": "views.py",
"copies": "1",
"size": "1114",
"license": "bsd-2-clause",
"hash": -5260613749838213000,
"line_mean": 30.8571428571,
"line_max": 83,
"alpha_frac": 0.6059245961,
"autogenerated": false,
"ratio": 4.301158301158301,
"config_test": false,
"has_no... |
from django.template.response import TemplateResponse
from django.http import Http404, HttpResponseRedirect
from django.views.generic.edit import ProcessFormView
from django.views.generic.detail import SingleObjectMixin
from yawf import get_workflow
from yawf import dispatch
from yawf.exceptions import MessageValidati... | {
"repo_name": "freevoid/yawf",
"path": "yawf/views.py",
"copies": "1",
"size": "3876",
"license": "mit",
"hash": -64238194691588616,
"line_mean": 28.8153846154,
"line_max": 79,
"alpha_frac": 0.580753354,
"autogenerated": false,
"ratio": 4.2781456953642385,
"config_test": false,
"has_no_keywor... |
from django.template.response import TemplateResponse
from django.http import Http404
from django.http import HttpResponse, HttpResponseNotFound
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import get_object_or_404
import datetime
import math
from vote_app.models import Voter, Discussion,... | {
"repo_name": "hmartiro/voting-cfp",
"path": "voting_project/vote_app/views.py",
"copies": "1",
"size": "3371",
"license": "mit",
"hash": -1118599076714683400,
"line_mean": 27.3277310924,
"line_max": 95,
"alpha_frac": 0.6090180955,
"autogenerated": false,
"ratio": 3.5409663865546217,
"config_te... |
from django.template.response import TemplateResponse
from django.middleware.csrf import CsrfViewMiddleware
from django.conf import settings
from hyperadmin.mediatypes.common import MediaType
class Html5MediaType(MediaType):
template_name = 'hyperadmin/html5/resource.html'
template_dir_name = 'hyperadmin/htm... | {
"repo_name": "webcube/django-hyperadmin",
"path": "hyperadmin/mediatypes/html5.py",
"copies": "1",
"size": "3796",
"license": "bsd-3-clause",
"hash": -6928794707916374000,
"line_mean": 35.854368932,
"line_max": 133,
"alpha_frac": 0.5940463646,
"autogenerated": false,
"ratio": 4.250839865621501,
... |
from django.template.response import TemplateResponse
from django.shortcuts import get_object_or_404
from django import http
from django.conf import settings
from NextPlease import pagination
from .models import Blog, Post, Category
PIZZA_PODCAST_OWNER = getattr(settings, 'PIZZA_PODCAST_OWNER', 'John Doe')
PIZZA_POD... | {
"repo_name": "pizzapanther/Django-Pizza",
"path": "pizza/blog/views.py",
"copies": "1",
"size": "2463",
"license": "bsd-3-clause",
"hash": -3258044457289458700,
"line_mean": 32.2972972973,
"line_max": 97,
"alpha_frac": 0.6751928542,
"autogenerated": false,
"ratio": 3.09811320754717,
"config_te... |
from django.template.response import TemplateResponse
from django.template import loader
from rhinocloud.utils import PDF
#from rhinocloud.utils.pdf import convert_to_pdf
from rhinocloud.template import openoffice
from subprocess import Popen, PIPE
class PDFTemplateResponse(TemplateResponse):
def __init__(self, ... | {
"repo_name": "allanlei/rhinocloud-utils",
"path": "rhinocloud/template/response.py",
"copies": "1",
"size": "1467",
"license": "bsd-3-clause",
"hash": -4717118898423891000,
"line_mean": 38.6486486486,
"line_max": 114,
"alpha_frac": 0.6864349012,
"autogenerated": false,
"ratio": 3.830287206266318... |
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.utils.functional import lazy_property
from django.views.decorators.cache import never_cache
from django.views.generic.detail import SingleObjectMixin
from notorhot.models import CandidateCategory
cl... | {
"repo_name": "sbnoemi/notorhot",
"path": "notorhot/utils.py",
"copies": "1",
"size": "3693",
"license": "bsd-3-clause",
"hash": -5112986100825845000,
"line_mean": 36.3131313131,
"line_max": 80,
"alpha_frac": 0.6598971026,
"autogenerated": false,
"ratio": 4.465538089480049,
"config_test": false... |
from django.template.response import TemplateResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from .utils import total_seconds
from . import utils
ALLOWED_RESPONSE_TYPES = ("code", "token", )
ALLOWED_GRANT_TYPES = ("authorization_code", "refresh_token", )
class O... | {
"repo_name": "Rediker-Software/doac",
"path": "doac/views.py",
"copies": "1",
"size": "13761",
"license": "mit",
"hash": 6888076789479624000,
"line_mean": 32.8108108108,
"line_max": 133,
"alpha_frac": 0.6315674733,
"autogenerated": false,
"ratio": 4.614688128772636,
"config_test": false,
"ha... |
from django.template.response import TemplateResponse
from django.views.generic.base import TemplateResponseMixin, TemplateView
import weasyprint
from ..pdf import UrlFetcher
class PDFTemplateResponse(TemplateResponse):
url_fetcher_class = UrlFetcher
def __init__(self, filename=None, *args, **kwargs):
... | {
"repo_name": "Clarity-89/clarityv2",
"path": "src/clarityv2/utils/views/pdf.py",
"copies": "1",
"size": "1753",
"license": "mit",
"hash": 9026934421607062000,
"line_mean": 30.3035714286,
"line_max": 88,
"alpha_frac": 0.660011409,
"autogenerated": false,
"ratio": 4.067285382830627,
"config_test... |
from django.template.response import TemplateResponse
from django.views.generic.base import TemplateView
from rest_framework import generics
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from .forms import SettingsForm
from .models import Speed, AverageQuality, Settings... | {
"repo_name": "krstnschwpwr/speedcontrol",
"path": "probe/views.py",
"copies": "1",
"size": "5115",
"license": "mit",
"hash": -3333125336152021500,
"line_mean": 33.5608108108,
"line_max": 127,
"alpha_frac": 0.6283479961,
"autogenerated": false,
"ratio": 4.223781998348472,
"config_test": false,
... |
from django.template.response import TemplateResponse
from oscar.apps.checkout.views import (PaymentMethodView as CorePaymentMethodView,
PaymentDetailsView as CorePaymentDetailsView,
OrderPreviewView as CoreOrderPreviewView)
from oscar.apps.payment.f... | {
"repo_name": "aykut/django-oscar",
"path": "examples/demo/shop/checkout/views.py",
"copies": "1",
"size": "5388",
"license": "bsd-3-clause",
"hash": -2163806952261476900,
"line_mean": 43.1639344262,
"line_max": 113,
"alpha_frac": 0.632887899,
"autogenerated": false,
"ratio": 4.15420200462606,
... |
from django.template.response import TemplateResponse
from us_ignite.common.response import json_response
from us_ignite.maps.models import Location
def location_list(request):
"""Shows a list of locations in a map."""
object_list = Location.published.select_related('category').all()
context = {
... | {
"repo_name": "us-ignite/us_ignite",
"path": "us_ignite/maps/views.py",
"copies": "1",
"size": "1246",
"license": "bsd-3-clause",
"hash": -853944304749746300,
"line_mean": 30.9487179487,
"line_max": 71,
"alpha_frac": 0.6629213483,
"autogenerated": false,
"ratio": 3.7872340425531914,
"config_tes... |
from django.templatetags.i18n import TranslateNode, BlockTranslateNode
from django.template import RequestContext
import hashlib
def get_key_hash(key):
return hashlib.md5(key.encode('utf-8')).hexdigest()
def get_wrapped_content(key, content):
if not key:
return content
return '<span class="djan... | {
"repo_name": "akolpakov/django-inline-translations",
"path": "django_inline_translations/translate.py",
"copies": "1",
"size": "1072",
"license": "mit",
"hash": -1775886239383569400,
"line_mean": 27.2105263158,
"line_max": 114,
"alpha_frac": 0.6567164179,
"autogenerated": false,
"ratio": 4.07604... |
from django.templatetags.static import static as get_static_url
from django.shortcuts import redirect
from .exceptions import UnknownMessageTypeError
from .models import Dispatch
from .signals import sig_unsubscribe_failed, sig_mark_read_failed
def _generic_view(message_method, fail_signal, request, message_id, disp... | {
"repo_name": "idlesign/django-sitemessage",
"path": "sitemessage/views.py",
"copies": "1",
"size": "2237",
"license": "bsd-3-clause",
"hash": 3244445167399735300,
"line_mean": 27.3164556962,
"line_max": 107,
"alpha_frac": 0.652212785,
"autogenerated": false,
"ratio": 4.001788908765653,
"config... |
from django.templatetags.static import static
from .models import Document, Sentence, Word, Locuteur
from celery import shared_task
from xml.etree import ElementTree
import os, sys
reload(sys)
sys.setdefaultencoding("utf-8")
@shared_task
def addDocumentDatabase(document_id, chemin_xml):
# MYDIR permet de recupe... | {
"repo_name": "rachidoulasri/django_projectwebpage",
"path": "authentification/tasks.py",
"copies": "1",
"size": "3021",
"license": "mit",
"hash": -7233018620522934000,
"line_mean": 29.8265306122,
"line_max": 85,
"alpha_frac": 0.551142006,
"autogenerated": false,
"ratio": 3.9907529722589166,
"c... |
from django_tenants.middleware.suspicious import SuspiciousTenantMiddleware
from django_tenants.utils import get_public_schema_name, get_tenant_model
class DefaultTenantMiddleware(SuspiciousTenantMiddleware):
"""
Extend the SuspiciousTenantMiddleware in scenario where you want to
configure a tenant to be ... | {
"repo_name": "sigma-geosistemas/django-tenants",
"path": "django_tenants/middleware/default.py",
"copies": "1",
"size": "1079",
"license": "mit",
"hash": 1628699950430115800,
"line_mean": 42.16,
"line_max": 90,
"alpha_frac": 0.7043558851,
"autogenerated": false,
"ratio": 4.477178423236515,
"co... |
from django_tenants.migration_executors import get_executor
from django_tenants.utils import get_tenant_model, get_public_schema_name, schema_exists, get_tenant_database_alias, \
has_multi_type_tenants, get_multi_type_database_field_name
from django_tenants.management.commands import SyncCommon
class MigrateSchem... | {
"repo_name": "tomturner/django-tenants",
"path": "django_tenants/management/commands/migrate_schemas.py",
"copies": "1",
"size": "5034",
"license": "mit",
"hash": -7509500316849835000,
"line_mean": 60.3902439024,
"line_max": 118,
"alpha_frac": 0.580254271,
"autogenerated": false,
"ratio": 4.6353... |
from django.test.client import ClientHandler
from datetime import datetime
from datetime import timedelta
from linkcheck.models import Link
from linkcheck.models import Url
from linkcheck_settings import MAX_URL_LENGTH
class LinkCheckHandler(ClientHandler):
#customize the ClientHandler to allow us removing some m... | {
"repo_name": "pombredanne/django-linkcheck",
"path": "linkcheck/utils.py",
"copies": "4",
"size": "4328",
"license": "bsd-3-clause",
"hash": -321567134014707260,
"line_mean": 40.219047619,
"line_max": 131,
"alpha_frac": 0.5822550832,
"autogenerated": false,
"ratio": 4.475698035160289,
"config_... |
from django.test.client import ClientHandler
from datetime import datetime
from datetime import timedelta
from linkcheck.models import Link
from linkcheck.models import Url
class LinkCheckHandler(ClientHandler):
#customize the ClientHandler to allow us removing some middlewares
def load_middleware(self):
... | {
"repo_name": "vishalsodani/django-linkcheck",
"path": "linkcheck/utils.py",
"copies": "1",
"size": "4162",
"license": "bsd-3-clause",
"hash": -4286407769082840000,
"line_mean": 39.8039215686,
"line_max": 131,
"alpha_frac": 0.5773666506,
"autogenerated": false,
"ratio": 4.494600431965443,
"conf... |
from django.test.client import Client
from django.conf import settings
from test_utils import TestCase
from commons.urlresolvers import reverse, split_path
get = lambda c, v, **kw: c.get(reverse(v, **kw), follow=True)
post = lambda c, v, data={}, **kw: c.post(reverse(v, **kw), data, follow=True)
class LocalizingC... | {
"repo_name": "mozilla/spark-eol",
"path": "apps/commons/tests/__init__.py",
"copies": "1",
"size": "1149",
"license": "bsd-3-clause",
"hash": -4077233023140099600,
"line_mean": 38.6551724138,
"line_max": 78,
"alpha_frac": 0.6570931245,
"autogenerated": false,
"ratio": 4.045774647887324,
"confi... |
from django.test.client import Client
from django.conf import settings
from test_utils import TestCase
from spark.urlresolvers import reverse, split_path
get = lambda c, v, **kw: c.get(reverse(v, **kw), follow=True)
post = lambda c, v, data={}, **kw: c.post(reverse(v, **kw), data, follow=True)
class LocalizingCli... | {
"repo_name": "mozilla/spark",
"path": "apps/spark/tests/__init__.py",
"copies": "1",
"size": "1147",
"license": "bsd-3-clause",
"hash": -397905680991292400,
"line_mean": 38.5862068966,
"line_max": 78,
"alpha_frac": 0.6564952049,
"autogenerated": false,
"ratio": 4.053003533568905,
"config_test"... |
from django.test.client import Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from usergroups.options import BaseUserGroupConfiguration
from usergroups import options
from usergroups.models import EmailInvitation
from usergroups.models import UserGroupApplication
from ... | {
"repo_name": "strange/django-usergroups",
"path": "example/groups/tests.py",
"copies": "1",
"size": "5839",
"license": "bsd-3-clause",
"hash": 419688750206219700,
"line_mean": 23.6371308017,
"line_max": 84,
"alpha_frac": 0.5733858537,
"autogenerated": false,
"ratio": 2.7844539818788747,
"confi... |
from django.test.client import Client
from django.contrib.auth.models import User
import logging
class AuthViews():
def setUpUsers(self):
self.user = User.objects.create_user( username="test", email="test@test.com", password="test" )
self.user.save()
self.staff_user = User.objects.create_u... | {
"repo_name": "ubgarbage/gae-blog",
"path": "test_utils.py",
"copies": "1",
"size": "1517",
"license": "bsd-3-clause",
"hash": -2578989118501566500,
"line_mean": 31.9782608696,
"line_max": 121,
"alpha_frac": 0.6255767963,
"autogenerated": false,
"ratio": 3.718137254901961,
"config_test": true,
... |
from django.test.client import Client
from django.contrib.auth.models import User
from projector.tests.base import ProjectorTestCase
from projector.models import Project, Milestone
class MilestoneTest(ProjectorTestCase):
def setUp(self):
self.client = Client()
cred = 'milestoner'
self.us... | {
"repo_name": "lukaszb/django-projector",
"path": "projector/tests/test_milestone.py",
"copies": "1",
"size": "3566",
"license": "bsd-3-clause",
"hash": 5556317026255701000,
"line_mean": 35.7628865979,
"line_max": 74,
"alpha_frac": 0.5515984296,
"autogenerated": false,
"ratio": 4.215130023640662,... |
from django.test.client import Client
from django.contrib.auth.models import User
from projector.tests.base import ProjectorTestCase
from projector.models import Project
from projector.utils import str2obj
from projector.settings import get_config_value
statuses = str2obj(get_config_value('DEFAULT_PROJECT_WORKFLOW'))... | {
"repo_name": "lukaszb/django-projector",
"path": "projector/tests/test_status.py",
"copies": "1",
"size": "1688",
"license": "bsd-3-clause",
"hash": 2637053715564160000,
"line_mean": 32.76,
"line_max": 76,
"alpha_frac": 0.6119668246,
"autogenerated": false,
"ratio": 3.9347319347319347,
"config... |
from django.test.client import Client
from django.core.management import call_command
from django.core.urlresolvers import reverse
# Very important - sexy css selectors to test template output
# All we have here is templaets so this was a life-saver!
# Please star: https://github.com/johnpaulett/django-with-asserts
fr... | {
"repo_name": "alixedi/django_coffee_table",
"path": "coffee_table/testproject/testapp/tests.py",
"copies": "1",
"size": "6984",
"license": "bsd-3-clause",
"hash": -5039609566179260000,
"line_mean": 36.5483870968,
"line_max": 80,
"alpha_frac": 0.6056701031,
"autogenerated": false,
"ratio": 4.0161... |
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.test import TestCase
from oscar.test.factories import create_product
from oscar.core.compat import get_user_model
from oscar.apps.customer.history_helpers import get_recently_viewed_product_ids
from oscar.templatetags.histor... | {
"repo_name": "michaelBenin/django-oscar",
"path": "tests/functional/customer/history_tests.py",
"copies": "1",
"size": "2544",
"license": "bsd-3-clause",
"hash": -5436929152080921000,
"line_mean": 38.1384615385,
"line_max": 116,
"alpha_frac": 0.6827830189,
"autogenerated": false,
"ratio": 3.8255... |
from django.test.client import Client
from django.core.urlresolvers import reverse
from ._utils import load_audio
from armstrong.dev.tests.utils import ArmstrongTestCase
from ..models import Audio
from audio_support.forms import AudioForm
class AudioViewTestCase(ArmstrongTestCase):
def setUp(self):
self... | {
"repo_name": "armstrong/armstrong.apps.audio",
"path": "armstrong/apps/audio/tests/views.py",
"copies": "1",
"size": "1567",
"license": "apache-2.0",
"hash": 7269055521676556000,
"line_mean": 37.2195121951,
"line_max": 119,
"alpha_frac": 0.6451818762,
"autogenerated": false,
"ratio": 3.695754716... |
from django.test.client import Client
from django.test import TestCase
from couchforms.util import spoof_submission
import uuid
from corehq.apps.receiverwrapper.util import get_submit_url
from corehq.apps.domain.shortcuts import create_domain
from django.core.urlresolvers import reverse
from corehq.apps.users.models im... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/apps/reports/tests/test_export_api.py",
"copies": "2",
"size": "5026",
"license": "bsd-3-clause",
"hash": 6068735961328088000,
"line_mean": 34.6453900709,
"line_max": 123,
"alpha_frac": 0.6215678472,
"autogenerated": false,
"ratio": 3.761976... |
from django.test.client import Client
from django.test import TestCase
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
class MockAdminTestCase(TestCase):
def setUp(self):
self.user = User(
username='test', email='test@exa... | {
"repo_name": "mattcaldwell/django-admin-utils",
"path": "tests/test_app/tests.py",
"copies": "2",
"size": "3059",
"license": "bsd-2-clause",
"hash": 6814075962246138000,
"line_mean": 41.4861111111,
"line_max": 86,
"alpha_frac": 0.6489048709,
"autogenerated": false,
"ratio": 3.776543209876543,
... |
from django.test.client import Client
from django.test import TestCase
from django.contrib.comments.models import Comment
from django.contrib.sites.models import Site
from blog.models import Post
from test_utils import AuthViews
from django.contrib.contenttypes.models import ContentType
import settings
import logging
... | {
"repo_name": "ubgarbage/gae-blog",
"path": "comment/tests.py",
"copies": "1",
"size": "1831",
"license": "bsd-3-clause",
"hash": -8335370186509454000,
"line_mean": 35.62,
"line_max": 81,
"alpha_frac": 0.6335335882,
"autogenerated": false,
"ratio": 3.7215447154471546,
"config_test": true,
"ha... |
from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
from model_mommy import mommy
from locations.models import Section
from users.models import Lageruser
class SectionTests(TestCase):
def setUp(self):
self.client = Client()
Lageruser.objects.cre... | {
"repo_name": "vIiRuS/Lagerregal",
"path": "locations/tests.py",
"copies": "1",
"size": "1862",
"license": "bsd-3-clause",
"hash": 3956994719565346000,
"line_mean": 36.24,
"line_max": 106,
"alpha_frac": 0.6686358754,
"autogenerated": false,
"ratio": 3.7314629258517034,
"config_test": true,
"h... |
from django.test.client import Client
from django.test import TestCase
class MingusClientTests(TestCase):
fixtures = ['test_data.json', ]
def setUp(self):
pass
def tearDown(self):
pass
def test_HomePage(self):
'''Test if the homepage renders.'''
c = Client()
... | {
"repo_name": "azizmb/django-mingus",
"path": "mingus/tests.py",
"copies": "2",
"size": "3984",
"license": "apache-2.0",
"hash": 2935086640052086000,
"line_mean": 26.6666666667,
"line_max": 87,
"alpha_frac": 0.5830823293,
"autogenerated": false,
"ratio": 4.141372141372141,
"config_test": true,
... |
from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
from amon.apps.account.models import user_preferences_model, forgotten_pass_tokens_model
User = get_user_model()
class TestAccountForms(TestC... | {
"repo_name": "martinrusev/amonone",
"path": "amon/apps/account/tests/forms_test.py",
"copies": "1",
"size": "4733",
"license": "mit",
"hash": 5870797776321213000,
"line_mean": 30.9797297297,
"line_max": 107,
"alpha_frac": 0.6372279738,
"autogenerated": false,
"ratio": 3.7713147410358565,
"conf... |
# from django.test.client import Client
# from django.urls import reverse
# from django.test import TestCase
# from nose.tools import *
# from django.contrib.auth import get_user_model
User = get_user_model()
# class TestIntegrationsUrls(TestCase):
# def setUp(self):
# self.c = Client()
# self.u... | {
"repo_name": "martinrusev/amonone",
"path": "amon/apps/cloudservers/tests/views_tests.py",
"copies": "1",
"size": "1475",
"license": "mit",
"hash": -4757349713283398000,
"line_mean": 24.4310344828,
"line_max": 87,
"alpha_frac": 0.6054237288,
"autogenerated": false,
"ratio": 3.2560706401766004,
... |
from django.test.client import Client
import unittest
class MingusClientTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_HomePage(self):
'''Test if the homepage renders.'''
c = Client()
response = c.get('/')
self.failUnle... | {
"repo_name": "brixtonasias/sk-mingus",
"path": "mingus/tests.py",
"copies": "1",
"size": "3936",
"license": "bsd-3-clause",
"hash": -8748669662525760000,
"line_mean": 26.5244755245,
"line_max": 87,
"alpha_frac": 0.5835873984,
"autogenerated": false,
"ratio": 4.147523709167545,
"config_test": t... |
from django.test.client import Client
from ..documents import Test001Parent
from ..forms import Test002StringFieldForm, Test003FormFieldOrder
from testprj.tests import MongoengineTestCase
class MongoformsRegressionTests(MongoengineTestCase):
def test001_possible_changes_loose_in_ReferenceField_clean_method(sel... | {
"repo_name": "pimentech/django-mongoforms",
"path": "testprj/testapp/tests/regression.py",
"copies": "1",
"size": "1758",
"license": "bsd-3-clause",
"hash": -5934793835839701000,
"line_mean": 34.8775510204,
"line_max": 76,
"alpha_frac": 0.6513083049,
"autogenerated": false,
"ratio": 4.1364705882... |
from django.test.client import Client
from nose.tools import eq_
from cyder.base.tests import TestCase
from cyder.base.tests.test_views_base import GenericViewTests, format_response
from cyder.core.ctnr.models import Ctnr
from cyder.cydns.address_record.models import AddressRecord
from cyder.cydns.cname.models import... | {
"repo_name": "zeeman/cyder",
"path": "cyder/cydns/tests/test_views.py",
"copies": "1",
"size": "12309",
"license": "bsd-3-clause",
"hash": -8923847270486970000,
"line_mean": 30.4808184143,
"line_max": 79,
"alpha_frac": 0.5717767487,
"autogenerated": false,
"ratio": 3.4125311893540338,
"config_... |
from django.test.client import Client
from openslides.motions.models import Motion
from openslides.users.models import User
from openslides.utils.test import TestCase
class MotionPDFTest(TestCase):
"""
Tests for motion PDF.
"""
def setUp(self):
# Admin
self.admin = User.objects.get(pk... | {
"repo_name": "rolandgeider/OpenSlides",
"path": "tests/old/motions/test_pdf.py",
"copies": "1",
"size": "1861",
"license": "mit",
"hash": -6182388193872932000,
"line_mean": 40.3555555556,
"line_max": 82,
"alpha_frac": 0.6652337453,
"autogenerated": false,
"ratio": 3.452690166975881,
"config_te... |
from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.users.forms import InviteForm
from amon.apps.users.models import invite_model
class Te... | {
"repo_name": "martinrusev/amonone",
"path": "amon/apps/users/tests/forms_test.py",
"copies": "1",
"size": "1350",
"license": "mit",
"hash": -6644462235417154000,
"line_mean": 24.5098039216,
"line_max": 85,
"alpha_frac": 0.6259259259,
"autogenerated": false,
"ratio": 3.6193029490616624,
"config... |
from django.test.client import RequestFactory
from django.core.urlresolvers import RegexURLResolver
from hyperadmin.apirequests import NamespaceAPIRequest
from hyperadmin.endpoints import RootEndpoint
class MockSession(dict):
def flush(self):
pass
class SuperUserRequestFactory(RequestFactory):
def _... | {
"repo_name": "webcube/django-hyperadmin",
"path": "hyperadmin/tests/common.py",
"copies": "2",
"size": "2020",
"license": "bsd-3-clause",
"hash": 7620490163953284000,
"line_mean": 39.4,
"line_max": 145,
"alpha_frac": 0.6851485149,
"autogenerated": false,
"ratio": 4.08080808080808,
"config_test... |
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from crashstats.base.tests.testbase import TestCase
from crashstats.base.templatetags.jinja_helpers import (
change_query_string,
url
)
class TestChangeURL(TestCase):
def test_root_url_no_query_string(self):
... | {
"repo_name": "Tayamarn/socorro",
"path": "webapp-django/crashstats/base/tests/test_jinja_helpers.py",
"copies": "1",
"size": "3122",
"license": "mpl-2.0",
"hash": -1237950381234495200,
"line_mean": 34.0786516854,
"line_max": 79,
"alpha_frac": 0.6050608584,
"autogenerated": false,
"ratio": 3.9821... |
from django.test.client import RequestFactory
from django.urls import reverse
from allauth.socialaccount.models import SocialToken
from allauth.socialaccount.providers.oauth2.client import OAuth2Error
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase, mocked_re... | {
"repo_name": "pennersr/django-allauth",
"path": "allauth/socialaccount/providers/twitch/tests.py",
"copies": "2",
"size": "3269",
"license": "mit",
"hash": 5318069057026169000,
"line_mean": 38.3855421687,
"line_max": 142,
"alpha_frac": 0.6368920159,
"autogenerated": false,
"ratio": 3.67303370786... |
from django.test.client import RequestFactory
from django.urls import reverse
from saleor.dashboard.templatetags.utils import construct_get_query, paginate
def test_construct_get_query_get_and_params():
request = RequestFactory().get(reverse('dashboard:product-list'))
context = {'request': request}
resul... | {
"repo_name": "UITools/saleor",
"path": "tests/dashboard/test_utils.py",
"copies": "3",
"size": "1145",
"license": "bsd-3-clause",
"hash": -3126315580471808000,
"line_mean": 33.696969697,
"line_max": 77,
"alpha_frac": 0.6707423581,
"autogenerated": false,
"ratio": 3.9482758620689653,
"config_te... |
from django.test.client import RequestFactory
from mock import ANY, Mock
from unittest2 import TestCase
from .helpers import RequestPatchMixin
from .test_views import (
QuickTimeoutProxy, SpecifiedCertProxy, TestProxy, UnverifiedSSLProxy)
class HttpProxyConfigVerification(TestCase, RequestPatchMixin):
def se... | {
"repo_name": "thomasw/djproxy",
"path": "tests/view_configuration_tests.py",
"copies": "1",
"size": "7246",
"license": "mit",
"hash": 1865046276281907200,
"line_mean": 37.5425531915,
"line_max": 79,
"alpha_frac": 0.6636765112,
"autogenerated": false,
"ratio": 3.768070722828913,
"config_test": ... |
from django.test.client import RequestFactory
from olympia.git.models import GitExtractionEntry
from pyquery import PyQuery as pq
from django.conf import settings
from django.contrib import admin
from django.contrib.messages.storage import (
default_storage as default_messages_storage)
from olympia import amo, co... | {
"repo_name": "eviljeff/olympia",
"path": "src/olympia/addons/tests/test_admin.py",
"copies": "1",
"size": "33610",
"license": "bsd-3-clause",
"hash": -2627083763646232000,
"line_mean": 45.1675824176,
"line_max": 79,
"alpha_frac": 0.6290389765,
"autogenerated": false,
"ratio": 3.7146330680813437,... |
from django.test.client import RequestFactory
from open_facebook.api import OpenFacebook, FacebookAuthorization
from django.core.handlers.base import BaseHandler
class RequestMock(RequestFactory):
'''
Didn't see another solution for this. Decided to read some snippets
and modded them into the requestfact... | {
"repo_name": "marcelometal/Django-facebook",
"path": "django_facebook/test_utils/mocks.py",
"copies": "2",
"size": "2748",
"license": "bsd-3-clause",
"hash": -3045540709364498000,
"line_mean": 34.2307692308,
"line_max": 95,
"alpha_frac": 0.6422852984,
"autogenerated": false,
"ratio": 4.208269525... |
from django.test.client import RequestFactory
from tenant_schemas.middleware import TenantMiddleware
from tenant_schemas.tests.models import Tenant
from tenant_schemas.tests.testcases import BaseTestCase
class RoutesTestCase(BaseTestCase):
def setUp(self):
super(RoutesTestCase, self).setUp()
self... | {
"repo_name": "alexjillard/django-tenant-schemas",
"path": "tenant_schemas/tests/routes.py",
"copies": "1",
"size": "1491",
"license": "mit",
"hash": -9214907276037809000,
"line_mean": 32.8863636364,
"line_max": 79,
"alpha_frac": 0.637156271,
"autogenerated": false,
"ratio": 4.247863247863248,
... |
from django.test.client import RequestFactory
import mock
from nose.tools import eq_, ok_
from pyquery import PyQuery as pq
import mkt
import mkt.site.tests
from mkt.constants.payments import (PAYMENT_METHOD_ALL, PAYMENT_METHOD_CARD,
PAYMENT_METHOD_OPERATOR)
from mkt.developers imp... | {
"repo_name": "shahbaz17/zamboni",
"path": "mkt/developers/tests/test_forms_payments.py",
"copies": "1",
"size": "26138",
"license": "bsd-3-clause",
"hash": -3661282472616820700,
"line_mean": 41.5700325733,
"line_max": 79,
"alpha_frac": 0.6298875201,
"autogenerated": false,
"ratio": 3.67416362102... |
from django.test.client import RequestFactory
import pyquery
from nose.tools import eq_, raises
from kitsune.sumo.helpers import paginator
from kitsune.sumo.paginator import EmptyPage, PageNotAnInteger
from kitsune.sumo.tests import TestCase
from kitsune.sumo.urlresolvers import reverse
from kitsune.sumo.utils import... | {
"repo_name": "silentbob73/kitsune",
"path": "kitsune/sumo/tests/test_pagination.py",
"copies": "13",
"size": "3318",
"license": "bsd-3-clause",
"hash": -8741302625634606000,
"line_mean": 31.8514851485,
"line_max": 66,
"alpha_frac": 0.6154309825,
"autogenerated": false,
"ratio": 3.514830508474576... |
from django.test.client import RequestFactory
class ClassBasedViewTestResponse(object):
"""Gets a response from a class based view via the request factory."""
def get_response(self, view, url, user, data=None, method='get',
request_kwargs=None, view_kwargs=None, as_view_kwargs=None,
... | {
"repo_name": "InfoAgeTech/django-testing",
"path": "django_testing/testcases/class_based_views.py",
"copies": "1",
"size": "3379",
"license": "mit",
"hash": 2114813726115471000,
"line_mean": 39.7108433735,
"line_max": 80,
"alpha_frac": 0.4832790766,
"autogenerated": false,
"ratio": 4.91133720930... |
from django.test.client import RequestFactory
from open_facebook.api import OpenFacebook, FacebookAuthorization
from django.core.handlers.base import BaseHandler
class RequestMock(RequestFactory):
'''
Didn't see another solution for this. Decided to read some snippets
and modded them into the requ... | {
"repo_name": "fogcitymarathoner/djfb",
"path": "facebook_example/django_facebook/test_utils/mocks.py",
"copies": "2",
"size": "2804",
"license": "bsd-3-clause",
"hash": 1539197340489318100,
"line_mean": 35.3866666667,
"line_max": 103,
"alpha_frac": 0.6294579173,
"autogenerated": false,
"ratio": ... |
from django.test import Client, LiveServerTestCase
from django.utils import timezone
from blog.models import Post
class PostViewTest(LiveServerTestCase):
def setUp(self):
self.client = Client()
def test_index(self):
post = Post()
post.title = 'My first post'
post.text = 'This... | {
"repo_name": "dangerdak/apuniverse",
"path": "apuniverse/blog/test_views.py",
"copies": "1",
"size": "1154",
"license": "mit",
"hash": -3521190536447698000,
"line_mean": 31.9714285714,
"line_max": 77,
"alpha_frac": 0.6273830156,
"autogenerated": false,
"ratio": 3.859531772575251,
"config_test"... |
from django.test import Client
from django.contrib.messages import SUCCESS
from django.contrib.auth.models import User
# This test class gives us access to the Jinja2 template context
from test_utils import TestCase
from ignite.tests.decorators import ignite_skip
from users.models import Profile, Link
from projects.mo... | {
"repo_name": "mozilla/mozilla-ignite",
"path": "apps/users/tests/test_profiles.py",
"copies": "1",
"size": "3556",
"license": "bsd-3-clause",
"hash": 466005299982811840,
"line_mean": 38.5111111111,
"line_max": 79,
"alpha_frac": 0.6113610799,
"autogenerated": false,
"ratio": 4.368550368550369,
... |
from django.test import Client
from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import WSGIRequest
class RequestFactory(Client):
"""
Taken from DjangoSnippet 963, http://www.djangosnippets.org/snippets/963/
Class that lets you create mock Request objects for use in testing.... | {
"repo_name": "praekelt/panya",
"path": "panya/utils/tests.py",
"copies": "1",
"size": "1548",
"license": "bsd-3-clause",
"hash": 1962506457843079200,
"line_mean": 31.9361702128,
"line_max": 77,
"alpha_frac": 0.6052971576,
"autogenerated": false,
"ratio": 4.372881355932203,
"config_test": true,... |
from django.test import Client
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.base import BaseHandler
class RequestFactory(Client):
"""Class that lets you create mock Request objects for use in testing.
Usage:
rf = RequestFactory()
get_request = rf.get('/hello/')
pos... | {
"repo_name": "kumar303/rockit",
"path": "vendor-local/djcelery/tests/req.py",
"copies": "1",
"size": "2256",
"license": "bsd-3-clause",
"hash": -935995825309401600,
"line_mean": 31.6956521739,
"line_max": 78,
"alpha_frac": 0.6143617021,
"autogenerated": false,
"ratio": 4.072202166064982,
"conf... |
from django.test import Client
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
import datetime
from core.tests.base import BaseTestCase
from profiles.utils import set_expiration_date
class ProfileViewTestCase(BaseTestCase):
def setUp(self):
super(ProfileViewTe... | {
"repo_name": "jupiny/EnglishDiary",
"path": "english_diary/profiles/tests/test_views.py",
"copies": "1",
"size": "2527",
"license": "mit",
"hash": -2898379116061908000,
"line_mean": 25.0515463918,
"line_max": 75,
"alpha_frac": 0.5524337159,
"autogenerated": false,
"ratio": 4.50445632798574,
"c... |
from django.test import Client
from django.core.urlresolvers import reverse
from events.models import Event
from django.test import TestCase
client = Client()
class EventsTestCase(TestCase):
fixtures = ['auth', 'events',]
def setUp(self):
self.event = Event.objects.get(pk=3)
def testEventsIndex(self):
re... | {
"repo_name": "myles-archive/asgard-calendar",
"path": "events/tests.py",
"copies": "2",
"size": "1812",
"license": "bsd-3-clause",
"hash": 7264802314207140000,
"line_mean": 31.3571428571,
"line_max": 87,
"alpha_frac": 0.7328918322,
"autogenerated": false,
"ratio": 3.224199288256228,
"config_te... |
from django.test import Client
from django.test.client import RequestFactory
import json
import pytest
import os
import msgpack
from ..models import TaxBrainRun, TaxSaveInputs
from ..mock_compute import NodeDownCompute, MockFailedCompute
import taxcalc
from ...test_assets.utils import (check_posted_params, do_micro_s... | {
"repo_name": "OpenSourcePolicyCenter/PolicyBrain",
"path": "webapp/apps/taxbrain/tests/test_views.py",
"copies": "2",
"size": "30482",
"license": "mit",
"hash": -2291961892411503600,
"line_mean": 37.7811704835,
"line_max": 79,
"alpha_frac": 0.5486844695,
"autogenerated": false,
"ratio": 3.654477... |
from django.test import Client
from django.test import TestCase
from populate_database import populate_database
from django.urls import reverse
class IndexTestCase(TestCase):
"""This class provides a test case for the index. WOW!!!"""
@classmethod
def setUpTestData(cls):
"""
Loads the d... | {
"repo_name": "Metronus/metronus",
"path": "Metronus-Project/metronus_app/test/testIndex.py",
"copies": "1",
"size": "1778",
"license": "mpl-2.0",
"hash": -5913413985278153000,
"line_mean": 28.1475409836,
"line_max": 90,
"alpha_frac": 0.570303712,
"autogenerated": false,
"ratio": 4.17370892018779... |
from django.test import Client
from django.test import TestCase
class CategoryTestCase(TestCase):
def test_cas_category(self):
"""Test to ensure that CAS categories can be rendered properly"""
c = Client()
response = c.get('/categories/cas')
self.assertEqual(response.status_code, 20... | {
"repo_name": "WildCAS/CASCategorization",
"path": "journal/tests/test_category_type.py",
"copies": "1",
"size": "1646",
"license": "apache-2.0",
"hash": -8215902916498360000,
"line_mean": 41.2051282051,
"line_max": 78,
"alpha_frac": 0.6257594168,
"autogenerated": false,
"ratio": 4.35449735449735... |
from django.test import Client
from django.test import TestCase
from gollahalli_cms.gollahalli.sitemaps import Sitemap, xsl_content_type
from gollahalli_cms.gollahalli.utils import custom_date
class SiteMapTest(TestCase):
"""
Test case for ``sitemap`` urls
"""
def setUp(self):
# Testing the ... | {
"repo_name": "akshaybabloo/gollahalli-com",
"path": "gollahalli_cms/gollahalli/tests/test_sitemap.py",
"copies": "1",
"size": "3034",
"license": "mit",
"hash": -1726681827426492700,
"line_mean": 25.3826086957,
"line_max": 87,
"alpha_frac": 0.5533948583,
"autogenerated": false,
"ratio": 3.9097938... |
from django.test import Client
from django.test import TestCase
from logistics.permissions import is_driver, is_owner
class CommonApiTest(TestCase):
def test_login_logout(self):
c = Client()
response = c.post('/api/signup/', {"login": "owner1",
"passwor... | {
"repo_name": "geo2tag-logistics/Geo2Logistics",
"path": "logistics/tests.py",
"copies": "1",
"size": "2756",
"license": "apache-2.0",
"hash": 7314913316370906000,
"line_mean": 42.746031746,
"line_max": 84,
"alpha_frac": 0.4622641509,
"autogenerated": false,
"ratio": 4.488599348534202,
"config_... |
from django.test import Client
from django.urls import reverse
from rest_framework.status import HTTP_302_FOUND, HTTP_403_FORBIDDEN, HTTP_200_OK
from auth.tests.factories import UserFactory
from organizations.tests.factories import OrganizationFactory
from projects.tests.factories import ProjectFactory
def setup():
... | {
"repo_name": "bgroff/kala-app",
"path": "django_kala/projects/views/projects/tests/__init__.py",
"copies": "1",
"size": "5907",
"license": "mit",
"hash": 1897281720335126500,
"line_mean": 32.1853932584,
"line_max": 82,
"alpha_frac": 0.7008633824,
"autogenerated": false,
"ratio": 3.71275927089880... |
from django.test import Client
from django.urls import reverse
from fileserver.AdminWorker import generate_random_chars
from fileserver.ResponseFormatWorker import GetFormatForHttpQuery
from fileserver.ResponseWorker import ResponseType
from fileserver.TestWorker.CommonFunctions import \
IsCorrectStatusCodeRespon... | {
"repo_name": "opentelega/OpenTelega",
"path": "fileserver/TestWorker/AdminAuthTests.py",
"copies": "1",
"size": "1431",
"license": "mit",
"hash": -8123886170644966000,
"line_mean": 32.3023255814,
"line_max": 68,
"alpha_frac": 0.7239692523,
"autogenerated": false,
"ratio": 4.86734693877551,
"co... |
from django.test import Client
from django.urls import reverse
from fileserver.OutputTableHeader import OutputTableHeader
from fileserver.models import Option
from fileserver.ResponseWorker import ResponseType
from fileserver.ResponseFormatWorker import GetFormatForHttpQuery, \
DecodeOutputIntoTable
from fileser... | {
"repo_name": "opentelega/OpenTelega",
"path": "fileserver/TestWorker/ServerInitializationTest.py",
"copies": "1",
"size": "1414",
"license": "mit",
"hash": -5213660869633019000,
"line_mean": 31.0465116279,
"line_max": 68,
"alpha_frac": 0.7204066812,
"autogenerated": false,
"ratio": 4.08605341246... |
from django.test import Client
from django.urls import reverse
from fileserver.OutputTableHeader import OutputTableHeader
from fileserver.TestWorker.AdminAuthTests import \
CheckAdminAuthorization
from fileserver.TestWorker.UserAuthTests import \
CheckUserAuthorization
from fileserver.ResponseFormatWorker i... | {
"repo_name": "opentelega/OpenTelega",
"path": "fileserver/TestWorker/GetVersionTests.py",
"copies": "1",
"size": "1473",
"license": "mit",
"hash": -6270945231672958000,
"line_mean": 29.7083333333,
"line_max": 68,
"alpha_frac": 0.7189409369,
"autogenerated": false,
"ratio": 4.013623978201635,
"... |
from django.test import Client
from django.urls import reverse
from fileserver.ResponseWorker import ResponseType
from fileserver.AdminWorker import generate_random_chars
from fileserver.UserWorker import CheckUser
from fileserver.ResponseFormatWorker import DecodeOutputIntoTable, \
GetFormatForHttpQuery
from fi... | {
"repo_name": "opentelega/OpenTelega",
"path": "fileserver/TestWorker/ChangePasswordByUserTest.py",
"copies": "1",
"size": "1286",
"license": "mit",
"hash": 2557834354650558000,
"line_mean": 28.9302325581,
"line_max": 68,
"alpha_frac": 0.734836703,
"autogenerated": false,
"ratio": 4.3154362416107... |
from django.test import Client
from django.urls import reverse
from test_plus.test import TestCase
from bootcamp.qa.models import Question, Answer
class QAViewsTest(TestCase):
def setUp(self):
self.user = self.make_user("first_user")
self.other_user = self.make_user("second_user")
self.c... | {
"repo_name": "vitorfs/bootcamp",
"path": "bootcamp/qa/tests/test_views.py",
"copies": "1",
"size": "5075",
"license": "mit",
"hash": -5251456790129479000,
"line_mean": 37.7404580153,
"line_max": 87,
"alpha_frac": 0.5927093596,
"autogenerated": false,
"ratio": 4.024583663758921,
"config_test": ... |
from django.test import Client
from django.urls import reverse
import random
import base64
import os
from fileserver.ResponseWorker import ResponseType
from fileserver.OutputTableHeader import OutputTableHeader
from fileserver.UserWorker import CheckUser
from fileserver.models import User
from fileserver.TestWorker.... | {
"repo_name": "opentelega/OpenTelega",
"path": "fileserver/TestWorker/UserAdminControlTests.py",
"copies": "1",
"size": "6858",
"license": "mit",
"hash": -1297337788941155600,
"line_mean": 30.7546296296,
"line_max": 70,
"alpha_frac": 0.7162438029,
"autogenerated": false,
"ratio": 4.18937080024434... |
from django.test import client
from mailserver.handlers import BaseMessageHandler
from django.test import signals
from django.utils.functional import curry
class Client(client.Client):
def __init__(self, **defaults):
client.Client.__init__(self, **defaults)
self.handler = BaseMessageHandler()
... | {
"repo_name": "telenieko/django-mailserver",
"path": "src/mailserver/test.py",
"copies": "1",
"size": "1659",
"license": "bsd-3-clause",
"hash": 4825099063057629000,
"line_mean": 33.5625,
"line_max": 75,
"alpha_frac": 0.614225437,
"autogenerated": false,
"ratio": 4.532786885245901,
"config_test... |
from django.test import Client
from rest_framework.status import HTTP_403_FORBIDDEN, HTTP_400_BAD_REQUEST, HTTP_200_OK, HTTP_201_CREATED, \
HTTP_204_NO_CONTENT
from hadiths.tests.setup import TestCaseBase
class PersonGetApiTestCase(TestCaseBase):
def test__get_json__200(self):
resp = self.get_person()
... | {
"repo_name": "rafidka/hadithhouse",
"path": "hadiths/tests/tests_personapi.py",
"copies": "2",
"size": "9958",
"license": "mit",
"hash": 745966383991951700,
"line_mean": 47.5756097561,
"line_max": 120,
"alpha_frac": 0.6860815425,
"autogenerated": false,
"ratio": 3.342732460557234,
"config_test... |
from django.test import Client
from rest_framework.status import HTTP_403_FORBIDDEN, HTTP_400_BAD_REQUEST, \
HTTP_200_OK, HTTP_201_CREATED, \
HTTP_204_NO_CONTENT
from hadiths.tests.setup import TestCaseBase
class BookGetApiTestCase(TestCaseBase):
def test__get_json__200(self):
resp = self.get_boo... | {
"repo_name": "hadithhouse/hadithhouse",
"path": "hadiths/tests/tests_bookapi.py",
"copies": "2",
"size": "11637",
"license": "mit",
"hash": 6097565776924941000,
"line_mean": 45.1785714286,
"line_max": 80,
"alpha_frac": 0.6367620521,
"autogenerated": false,
"ratio": 3.7286126241589232,
"config_... |
from django.test import Client
from test_utils import TestCase, RequestFactory, setup_test_environment
setup_test_environment()
from django.core.urlresolvers import reverse
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.models import User
from models import StatusUpdate, OutageNoti... | {
"repo_name": "rtucker-mozilla/WhistlePig",
"path": "whistlepig/whistlepig/tests.py",
"copies": "1",
"size": "8787",
"license": "bsd-3-clause",
"hash": 7968576236884820000,
"line_mean": 45.7393617021,
"line_max": 92,
"alpha_frac": 0.6376465233,
"autogenerated": false,
"ratio": 3.855638437911365,
... |
from django.test import Client
import json
class RestClient(Client):
"""
Extends the ``django.test.Client`` with methods for the REST verbs and
application/json.
"""
def _load_json(self, content):
if content.strip() == '':
return None
try:
return json.loads... | {
"repo_name": "devilry/devilry-django",
"path": "devilry/devilry_rest/testclient.py",
"copies": "1",
"size": "1493",
"license": "bsd-3-clause",
"hash": 9138086909399745000,
"line_mean": 33.7209302326,
"line_max": 74,
"alpha_frac": 0.5197588747,
"autogenerated": false,
"ratio": 4.6802507836990594,... |
from django.test import Client
import pytest
import json
import sys
import msgpack
from ...taxbrain.mock_compute import MockCompute
from ..compute import ElasticMockCompute
from .utils import do_dynamic_sim, START_YEAR
from ...test_assets.utils import (do_micro_sim, get_post_data,
ge... | {
"repo_name": "OpenSourcePolicyCenter/PolicyBrain",
"path": "webapp/apps/dynamic/tests/test_elasticity.py",
"copies": "2",
"size": "4574",
"license": "mit",
"hash": -6732278055776920000,
"line_mean": 36.4918032787,
"line_max": 78,
"alpha_frac": 0.607564495,
"autogenerated": false,
"ratio": 3.5706... |
from django.test import Client
import pytest
from ...taxbrain.mock_compute import (MockCompute,
MockFailedCompute)
from ..compute import ElasticMockCompute
START_YEAR = '2016'
class DynamicViewsTests(object):
''' Test the views of this app. '''
def setUp(self):
... | {
"repo_name": "OpenSourcePolicyCenter/webapp-public",
"path": "webapp/apps/dynamic/tests/test_views.py",
"copies": "2",
"size": "5509",
"license": "mit",
"hash": -4896612621926514000,
"line_mean": 40.4210526316,
"line_max": 78,
"alpha_frac": 0.5656198947,
"autogenerated": false,
"ratio": 3.920996... |
from django.test import Client
from questionnaire.forms.sections import SectionForm, SubSectionForm
from questionnaire.models import Questionnaire, Section, SubSection
from questionnaire.tests.base_test import BaseTest
class SectionsViewTest(BaseTest):
def setUp(self):
self.client = Client()
se... | {
"repo_name": "testvidya11/ejrf",
"path": "questionnaire/tests/views/test_sections_view.py",
"copies": "1",
"size": "6630",
"license": "bsd-3-clause",
"hash": 5774175002622006000,
"line_mean": 50.4031007752,
"line_max": 132,
"alpha_frac": 0.6746606335,
"autogenerated": false,
"ratio": 3.836805555... |
from django.test import Client, RequestFactory, TestCase
from blog.models import Article, Category, Tag
from django.contrib.auth import get_user_model
from DjangoBlog.utils import get_current_site
from django.urls import reverse
from django.utils import timezone
from accounts.models import BlogUser
from comments.templa... | {
"repo_name": "liangliangyy/DjangoBlog",
"path": "comments/tests.py",
"copies": "1",
"size": "3485",
"license": "mit",
"hash": -2644330484505323000,
"line_mean": 32.8349514563,
"line_max": 78,
"alpha_frac": 0.5371592539,
"autogenerated": false,
"ratio": 4.60978835978836,
"config_test": true,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.