text
stringlengths
0
1.05M
meta
dict
from django.test import Client, SimpleTestCase from redis import StrictRedis class RedisTestCase(SimpleTestCase): indices = { 'my-app:ed54cda': '<html><head><meta name="my-app/config/environment" content="%7B%22baseURL%22%3A%22/%22%7D"></head><body><h1>my-app</h1><h2>ed54cda</h2></body></html>', ...
{ "repo_name": "bobisjan/django-ember-index", "path": "tests/acceptance/redis/__init__.py", "copies": "1", "size": "1964", "license": "mit", "hash": -8522558662614289000, "line_mean": 71.7407407407, "line_max": 214, "alpha_frac": 0.6410386965, "autogenerated": false, "ratio": 2.672108843537415, ...
from django.test import Client, SimpleTestCase, override_settings from django.utils.translation import override @override_settings(ROOT_URLCONF="view_tests.urls") class CsrfViewTests(SimpleTestCase): def setUp(self): super(CsrfViewTests, self).setUp() self.client = Client(enforce_csrf_checks=True...
{ "repo_name": "HonzaKral/django", "path": "tests/view_tests/tests/test_csrf.py", "copies": "15", "size": "3202", "license": "bsd-3-clause", "hash": 6055771126251109000, "line_mean": 41.1315789474, "line_max": 80, "alpha_frac": 0.580262336, "autogenerated": false, "ratio": 4.743703703703703, "co...
from django.test import Client, TestCase from activity import ActivityMiddleWare from mock import MagicMock from django.contrib.auth.models import User from userprofile.models import UserProfile, Follow, Notification from django.core.urlresolvers import resolve, reverse class ActivityMiddleWareTest(TestCase): """...
{ "repo_name": "andela/codango", "path": "codango/middleware/test_activity.py", "copies": "1", "size": "2808", "license": "mit", "hash": -366147819527672640, "line_mean": 38, "line_max": 96, "alpha_frac": 0.6203703704, "autogenerated": false, "ratio": 4.565853658536585, "config_test": true, "h...
from django.test import Client, TestCase from bug_reports.models import BugReport class TestBugReport(TestCase): def test_get_bug_report_view(self): c = Client() response = c.get("/report_problem/?source=foo&source_url=barbaz") self.assertEqual(200, response.status_code) expected_s...
{ "repo_name": "DemocracyClub/UK-Polling-Stations", "path": "polling_stations/apps/bug_reports/tests/test_bug_report.py", "copies": "1", "size": "3877", "license": "bsd-3-clause", "hash": -2568711821296894000, "line_mean": 38.5612244898, "line_max": 127, "alpha_frac": 0.5519731751, "autogenerated": ...
from django.test import Client, TestCase from django.conf import settings class ViewTest(TestCase): """ Simple test for views. """ def setUp(self): """ Set up the test class. """ self.client = Client() def test_index(self): """ Test the index view. """ response = self.client.get('/') self.as...
{ "repo_name": "frocentus/offenewahlen-nrw17", "path": "src/viz/tests/test_views.py", "copies": "1", "size": "1028", "license": "mit", "hash": 5975250694569622000, "line_mean": 21.8444444444, "line_max": 56, "alpha_frac": 0.6517509728, "autogenerated": false, "ratio": 2.839779005524862, "config_...
from django.test import Client, TestCase from django.contrib.auth import get_user_model import datetime as D from wafer.talks.models import Talk, ACCEPTED, REJECTED, PENDING from wafer.pages.models import Page from wafer.schedule.models import Day, Venue, Slot, ScheduleItem from wafer.schedule.admin import (find_overl...
{ "repo_name": "CarlFK/wafer", "path": "wafer/schedule/tests/test_schedule.py", "copies": "1", "size": "47416", "license": "isc", "hash": -5150822548253548000, "line_mean": 39.4918872758, "line_max": 78, "alpha_frac": 0.5435717901, "autogenerated": false, "ratio": 3.3090934468560262, "config_tes...
from django.test import Client, TestCase from django.contrib.auth.models import User from apps.shared.tests import check_url_perms, get_dummy_user, get_dummy_hypervisor class HypervisorTestCase(TestCase): def setUp(self): # create a test user self.user = get_dummy_user() # try localhost and default port...
{ "repo_name": "jawr/kontrolvm", "path": "apps/hypervisor/tests.py", "copies": "1", "size": "1796", "license": "mit", "hash": 443252955357321100, "line_mean": 32.8867924528, "line_max": 114, "alpha_frac": 0.6998886414, "autogenerated": false, "ratio": 3.5078125, "config_test": true, "has_no_ke...
from django.test import Client, TestCase from django.contrib.auth.models import User from ddcz.models import Phorum, UserProfile class PhorumCommentTestCase(TestCase): def setUp(self): super().setUp() self.client = Client() self.message = "Ahojky, já jsem Ignác Zlosynus" self.mess...
{ "repo_name": "dracidoupe/graveyard", "path": "ddcz/tests/test_integration/test_new_phorum_comment.py", "copies": "1", "size": "3078", "license": "mit", "hash": 746764001329175000, "line_mean": 32.6483516484, "line_max": 71, "alpha_frac": 0.576747224, "autogenerated": false, "ratio": 3.4994285714...
from django.test import Client, TestCase from django.core.urlresolvers import reverse from breach.models import Target, Victim, Round, SampleSet import json from binascii import hexlify from mock import patch class ViewsTestCase(TestCase): def setUp(self): self.client = Client() self.target1 = Ta...
{ "repo_name": "dimkarakostas/rupture", "path": "backend/breach/tests/test_views.py", "copies": "2", "size": "9985", "license": "mit", "hash": 1290053763697209300, "line_mean": 34.7885304659, "line_max": 152, "alpha_frac": 0.5869804707, "autogenerated": false, "ratio": 3.859683030537302, "config...
from django.test import Client, TestCase from django.core.urlresolvers import reverse from django.conf import settings from model_mommy import mommy from accounts.models import User class RegisterViewTestCase(TestCase): def setUp(self): self.client = Client() self.register_url = reverse('accoun...
{ "repo_name": "tyrielbr/jewcommerce", "path": "accounts/tests/test_views.py", "copies": "1", "size": "2850", "license": "cc0-1.0", "hash": -7803619070790807000, "line_mean": 33.7195121951, "line_max": 91, "alpha_frac": 0.6384399157, "autogenerated": false, "ratio": 3.639386189258312, "config_te...
from django.test import Client, TestCase from django.urls.base import reverse from forum.testutils.html_result_parser import CommentsPageParser VIEWNAME = 'forum:base:topic-comment-listing' class BasicTestCase(TestCase): """ Testing `topic_comment_listing` with basic tests. """ fixtures = [ ...
{ "repo_name": "karolyi/forum-django", "path": "backend/forum/base/tests/views/frontend/test_topic_comment_listing.py", "copies": "1", "size": "7041", "license": "mit", "hash": 7450336752018295000, "line_mean": 39.2342857143, "line_max": 76, "alpha_frac": 0.6036074421, "autogenerated": false, "rat...
from django.test import Client, TestCase from django.urls import reverse from . import admin from .models import Option, Post, User from .templatetags.djwp import bloginfo class PostTestCase(TestCase): def test_post_save(self): Post(author=User.objects.create()).save() def test_post_url(self): ...
{ "repo_name": "collinanderson/djwp", "path": "djwp/tests.py", "copies": "1", "size": "1769", "license": "cc0-1.0", "hash": -7474141098379298000, "line_mean": 36.6382978723, "line_max": 89, "alpha_frac": 0.6506500848, "autogenerated": false, "ratio": 3.7399577167019027, "config_test": true, "h...
from django.test import Client, TestCase from emailauth import forms c = Client() class FormTests(TestCase): def test_creation_form(self): form_data = {'email': 'test@test.com', 'password1': 'test1234', 'password2': 'test1234'} form = forms.UserCreationForm(form_data) # Testing if form ...
{ "repo_name": "martinlunde/RealBack", "path": "emailauth/tests.py", "copies": "1", "size": "1795", "license": "mit", "hash": -5723779682690116000, "line_mean": 35.6326530612, "line_max": 96, "alpha_frac": 0.617270195, "autogenerated": false, "ratio": 3.8354700854700856, "config_test": true, "...
from django.test import Client, TestCase from mock import patch from hc.api.models import Check, Ping class PingTestCase(TestCase): def setUp(self): super(PingTestCase, self).setUp() self.check = Check.objects.create() def execute(f, *args, **kwargs): return f(*args, **kwarg...
{ "repo_name": "BetterWorks/healthchecks", "path": "hc/api/tests/test_ping.py", "copies": "1", "size": "3081", "license": "bsd-3-clause", "hash": -6603443607949621000, "line_mean": 32.4891304348, "line_max": 78, "alpha_frac": 0.5699448231, "autogenerated": false, "ratio": 3.302250803858521, "con...
from django.test import Client, TestCase from polls.models import Poll, Choice from polls.tests import BaseTestCase class ReadOnlyTestCase(BaseTestCase): def testGetPolls(self): response = self.client.get('/rest/ropr/') self.assertEqual(response.status_code, 200) self.assertEqual(response...
{ "repo_name": "danrex/django-riv", "path": "tests/polls/tests/resources/base.py", "copies": "1", "size": "18098", "license": "mit", "hash": -3878331353138469400, "line_mean": 51.0057471264, "line_max": 285, "alpha_frac": 0.6269753564, "autogenerated": false, "ratio": 3.3910436574854788, "config...
from django.test import Client, TestCase from polls.models import Poll, Choice from polls.tests import BaseTestCase class StandaloneReadOnlyTestCase(BaseTestCase): def testGetPolls(self): response = self.client.get('/rest/srpr/') self.assertEqual(response.status_code, 200) # Resultset is ...
{ "repo_name": "danrex/django-riv", "path": "tests/polls/tests/resources/standalone.py", "copies": "1", "size": "11334", "license": "mit", "hash": 8811630552024832000, "line_mean": 48.7105263158, "line_max": 284, "alpha_frac": 0.6295217928, "autogenerated": false, "ratio": 3.3632047477744806, "c...
from django.test import client, TestCase from website.models import * from website.views import * from django.urls import reverse class ProductRelatedTests(TestCase): """ Purpose: Verifies that when a specific product category view is requested, that there are products in the response context. Also verifies t...
{ "repo_name": "illegal-llamas/djangazon", "path": "website/tests-refactored.py", "copies": "1", "size": "5997", "license": "mit", "hash": -6611900034160998000, "line_mean": 32.5027932961, "line_max": 308, "alpha_frac": 0.5852926463, "autogenerated": false, "ratio": 4.1103495544893764, "config_t...
from django.test import Client, TestCase from whatistheplan.models import Team, Game, UserProfile from django.contrib.auth.models import User class TeamTest(TestCase): def setUp(self): self.g1 = Game.objects.create(game_name='Counter Strike Source') self.g1.save() self.u1 = User.objects.cr...
{ "repo_name": "ccowmu/whatistheplan.com", "path": "tests/test_team.py", "copies": "1", "size": "1739", "license": "mit", "hash": 4824086573845976000, "line_mean": 33.0980392157, "line_max": 90, "alpha_frac": 0.6331224842, "autogenerated": false, "ratio": 3.1966911764705883, "config_test": true,...
from django.test import Client, TestCase from app.timetables.factories import ServingFactory from .utils import create_admin_account, make_request class ReviewApiTest(TestCase): """Test for Review API.""" def setUp(self): self.client = Client() create_admin_account() self.serving = S...
{ "repo_name": "teamtaverna/core", "path": "app/api/tests/test_review_api.py", "copies": "1", "size": "7653", "license": "mit", "hash": -2239980252900008000, "line_mean": 30.8875, "line_max": 89, "alpha_frac": 0.4084672677, "autogenerated": false, "ratio": 4.998693664271718, "config_test": true,...
from django.test import Client, TestCase from .utils import (admin_test_credentials, create_admin_account, make_request,) class UserApiTest(TestCase): """Test for User API""" def setUp(self): self.client = Client() create_admin_account() self.first_user = self.cre...
{ "repo_name": "teamtaverna/core", "path": "app/api/tests/test_user_api.py", "copies": "1", "size": "11996", "license": "mit", "hash": 4945768880471916000, "line_mean": 28.9152119701, "line_max": 90, "alpha_frac": 0.4176392131, "autogenerated": false, "ratio": 4.624518118735543, "config_test": t...
from django.test import Client, TestCase, override_settings from django.urls import resolve from django.contrib.auth.models import User DAO = 'Mock' @override_settings(RESTCLIENTS_MDOT_DAO_CLASS=DAO) class MdotTest(TestCase): """ Test for the functionality of the views and the urls. """ def setUp(se...
{ "repo_name": "uw-it-aca/mdot", "path": "mdot/test/url_and_view.py", "copies": "1", "size": "3296", "license": "apache-2.0", "hash": -7238542391594195000, "line_mean": 29.5185185185, "line_max": 66, "alpha_frac": 0.6046723301, "autogenerated": false, "ratio": 4.297262059973924, "config_test": t...
from django.test import Client, TestCase, override_settings from django.urls import resolve DAO = 'Mock' @override_settings(RESTCLIENTS_MDOT_DAO_CLASS=DAO) class MdotTest(TestCase): """ Test for the functionality of the views and the urls. """ def setUp(self): self.client = Client() ...
{ "repo_name": "charlon/mdot", "path": "mdot/test/url_and_view.py", "copies": "1", "size": "2703", "license": "apache-2.0", "hash": 5569711681751360000, "line_mean": 28.064516129, "line_max": 66, "alpha_frac": 0.5993340733, "autogenerated": false, "ratio": 4.33868378812199, "config_test": true, ...
from django.test import Client, TestCase, tag, override_settings from django.urls import reverse from django.conf import settings from django.core import mail from django.core.exceptions import ValidationError from django.contrib.auth import authenticate, get_user_model from django.contrib.gis.measure import D import...
{ "repo_name": "cityofsomerville/citydash", "path": "server/user/tests.py", "copies": "3", "size": "10674", "license": "mit", "hash": -4070896585148049000, "line_mean": 30.3020527859, "line_max": 470, "alpha_frac": 0.6128911373, "autogenerated": false, "ratio": 3.902742230347349, "config_test": ...
from django.test import Client, TestCase, tag, override_settings from django.contrib.auth import get_user_model from user.models import Subscription, UserProfile from .geocoder import Geocoder from .staff_notifications import UserNotificationForm import utils import warnings warnings.filterwarnings( 'ignore', ...
{ "repo_name": "codeforboston/cornerwise", "path": "server/shared/tests.py", "copies": "3", "size": "2807", "license": "mit", "hash": -6674023301126535000, "line_mean": 36.4266666667, "line_max": 223, "alpha_frac": 0.5838973994, "autogenerated": false, "ratio": 4.127941176470588, "config_test": ...
from django.test import LiveServerTestCase from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.contrib.auth import get_user_model from selenium.webdriver.common.keys import Keys from selenium import webdriver class FunctionalTest(StaticLiveServerTestCase): def setUp(self): ...
{ "repo_name": "sychsergiy/DocFlow", "path": "doc_flow/functional_tests/base.py", "copies": "1", "size": "1412", "license": "bsd-3-clause", "hash": -777301193901790100, "line_mean": 35.2051282051, "line_max": 108, "alpha_frac": 0.6763456091, "autogenerated": false, "ratio": 3.8579234972677594, "...
from django.test import LiveServerTestCase from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.contrib.auth.models import User import time from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui imp...
{ "repo_name": "TCDocProc/arch", "path": "app/website/helpers/integrate.py", "copies": "1", "size": "1638", "license": "mit", "hash": 7933600738880248000, "line_mean": 38.0238095238, "line_max": 132, "alpha_frac": 0.6568986569, "autogenerated": false, "ratio": 4.427027027027027, "config_test": t...
from django.test import LiveServerTestCase from django.test import TestCase from django.contrib.auth.models import User from selenium import webdriver import views from .models import Post class HomePageTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.impli...
{ "repo_name": "inchingforward/gh", "path": "gh/gh/tests.py", "copies": "1", "size": "1495", "license": "mit", "hash": -2139654193726847000, "line_mean": 37.358974359, "line_max": 109, "alpha_frac": 0.6588628763, "autogenerated": false, "ratio": 3.7281795511221945, "config_test": true, "has_no...
from django.test import LiveServerTestCase from django.utils.importlib import import_module from django.utils.unittest import SkipTest from django.utils.translation import ugettext as _ class AdminSeleniumWebDriverTestCase(LiveServerTestCase): webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver' ...
{ "repo_name": "Proggie02/TestRepo", "path": "django/contrib/admin/tests.py", "copies": "5", "size": "4204", "license": "bsd-3-clause", "hash": -2090106842856707300, "line_mean": 40.6237623762, "line_max": 89, "alpha_frac": 0.630114177, "autogenerated": false, "ratio": 4.420609884332282, "config...
from django.test import LiveServerTestCase from hammock import Hammock as AuthService from accounts.models import CampusUser from ..models import CampusPermission, CampusApplication class ExternalApiTest(LiveServerTestCase): API_URL = 'http://localhost:8081/api/v1' def setUp(self): self.application =...
{ "repo_name": "kpi-ua/campus.security-service", "path": "source/permissions/tests/external_api_test.py", "copies": "2", "size": "7094", "license": "mit", "hash": -2108566776499981800, "line_mean": 47.9310344828, "line_max": 128, "alpha_frac": 0.6587256837, "autogenerated": false, "ratio": 3.90853...
from django.test import LiveServerTestCase from selenium import webdriver from allauth.account.models import EmailAddress class AbstractTestCase(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.q...
{ "repo_name": "Farforr/overlord", "path": "functional_tests/tests.py", "copies": "2", "size": "11120", "license": "bsd-3-clause", "hash": -1341628362546126800, "line_mean": 36.6847457627, "line_max": 79, "alpha_frac": 0.6229198525, "autogenerated": false, "ratio": 3.7916098226466577, "config_te...
from django.test import LiveServerTestCase from selenium import webdriver from django.contrib.auth.models import User import sys class FunctionalTest(LiveServerTestCase): @classmethod def setUpClass(cls): for arg in sys.argv: if "liveserver" in arg: cls.server_url = "http:/...
{ "repo_name": "Faerbit/getraenkewart.de", "path": "functional_tests/base.py", "copies": "1", "size": "1793", "license": "mit", "hash": 342270273382374100, "line_mean": 32.2037037037, "line_max": 86, "alpha_frac": 0.6201896263, "autogenerated": false, "ratio": 3.906318082788671, "config_test": t...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys import unittest import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = w...
{ "repo_name": "philmui/superlists", "path": "functional_tests/tests.py", "copies": "1", "size": "3433", "license": "mit", "hash": 7915558359424758000, "line_mean": 38.9186046512, "line_max": 86, "alpha_frac": 0.6414214972, "autogenerated": false, "ratio": 3.5612033195020745, "config_test": true...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys import unittest import time class NewVisitorTest(LiveServerTestCase): """Web Application visitor""" def setUp(self): self.browser = webdriver.Firefox() # self.browser.impli...
{ "repo_name": "JMwill/wiki", "path": "notebook/book/python/Test-Driven-Development-With-Python/superlists/functional_tests/tests.py", "copies": "1", "size": "3574", "license": "mit", "hash": -7450393076284390000, "line_mean": 34.1395348837, "line_max": 79, "alpha_frac": 0.6403044341, "autogenerated...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys import unittest class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): ...
{ "repo_name": "renvieir/pytdd", "path": "functional_tests/tests.py", "copies": "1", "size": "2609", "license": "mit", "hash": -4781085321737585000, "line_mean": 39.1538461538, "line_max": 81, "alpha_frac": 0.644308164, "autogenerated": false, "ratio": 3.502013422818792, "config_test": true, "...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.quit...
{ "repo_name": "gnufede/booking", "path": "booking/functional_tests/tests.py", "copies": "1", "size": "1551", "license": "mit", "hash": 3082458517177443300, "line_mean": 32.7173913043, "line_max": 81, "alpha_frac": 0.6486137975, "autogenerated": false, "ratio": 3.371739130434783, "config_test": ...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.qui...
{ "repo_name": "linzeyang/testing_goat", "path": "functional_tests/tests.py", "copies": "1", "size": "4429", "license": "mit", "hash": 934648435522999900, "line_mean": 41.180952381, "line_max": 85, "alpha_frac": 0.6353578686, "autogenerated": false, "ratio": 3.481918238993711, "config_test": tru...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys class NewVisitorTest(LiveServerTestCase): ## Run before each test to start the browser. def setUp(self): self.browser = webdriver.Firefox() ## Wait for pages to complete l...
{ "repo_name": "Giovanni21M/SecP", "path": "functional_tests/tests.py", "copies": "1", "size": "4527", "license": "mit", "hash": 4667986587887229000, "line_mean": 40.9166666667, "line_max": 70, "alpha_frac": 0.6410426331, "autogenerated": false, "ratio": 3.686482084690554, "config_test": true, ...
from django.test import LiveServerTestCase from selenium import webdriver import autofixture from django.contrib.auth import hashers browser = [] def instance(): # other browsers can be set here, eg # webdriver.Firefox() # Firefox, however, requires you to load a page in the # domain before setting ...
{ "repo_name": "david12341235/django_selenium_phantomjs_optimize", "path": "django_selenium_phantomjs_optimize/browser.py", "copies": "1", "size": "1190", "license": "mit", "hash": -1123532513567210600, "line_mean": 29.5384615385, "line_max": 96, "alpha_frac": 0.6159663866, "autogenerated": false, ...
from django.test import LiveServerTestCase from selenium import webdriver class SeleniumTestCase(LiveServerTestCase): def setUp(self): self.client = webdriver.PhantomJS() def case_for_all_functions(self, address, should_find): # Navigate to the get ingo page self.client.get(self.live_...
{ "repo_name": "sandcage/sandcage-api-django", "path": "src/apigui/tests/tests.py", "copies": "1", "size": "2045", "license": "apache-2.0", "hash": 5540718038105890000, "line_mean": 30.953125, "line_max": 80, "alpha_frac": 0.6039119804, "autogenerated": false, "ratio": 3.698010849909584, "config...
from django.test import LiveServerTestCase from selenium import webdriver def populate_db(): from lorawan.tests import populate_db_with_devices populate_db_with_devices(["Devices 1", "Devices 2"]) class NewVisitorTest(LiveServerTestCase): def setUp(self): import os is_travis = 'TRAVIS...
{ "repo_name": "samdolt/iotdemo", "path": "functional_tests/tests.py", "copies": "2", "size": "1461", "license": "mit", "hash": -5758299499019263000, "line_mean": 28.22, "line_max": 123, "alpha_frac": 0.6509240246, "autogenerated": false, "ratio": 3.906417112299465, "config_test": true, "has_n...
from django.test import LiveServerTestCase from selenium import webdriver class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.quit() def test_can_create_a_post_and_retrive_...
{ "repo_name": "3quarterstack/simple_blog", "path": "blog/tests/functional_tests.py", "copies": "2", "size": "7186", "license": "mit", "hash": 2244894567538591000, "line_mean": 49.6056338028, "line_max": 79, "alpha_frac": 0.6026996938, "autogenerated": false, "ratio": 3.762303664921466, "config_...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.keys import Keys class MainPageTestCase(LiveServerTes...
{ "repo_name": "DimaWittmann/commute-together", "path": "commute_together/functional_tests/test.py", "copies": "1", "size": "1085", "license": "mit", "hash": -6250253885331164000, "line_mean": 25.0487804878, "line_max": 69, "alpha_frac": 0.75, "autogenerated": false, "ratio": 3.1411764705882352, ...
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys import unittest JASONS_CHROMEDRIVER_PATH = "/home/jason/apps/chromewebdriver/chromedriver" class NewVisitorTest(LiveServerTestCase): def setUp(self): # self.use_firefox() ...
{ "repo_name": "elbow-jason/learning-goat-django", "path": "functional_tests/test_new_visitor.py", "copies": "1", "size": "3993", "license": "mit", "hash": -3638614852139825000, "line_mean": 34.6517857143, "line_max": 74, "alpha_frac": 0.627598297, "autogenerated": false, "ratio": 3.46313963573287...
from django.test import LiveServerTestCase from selenium import webdriver class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.quit() def test_homepage_browse(self): ...
{ "repo_name": "knyghty/knyght", "path": "functional_tests/tests.py", "copies": "1", "size": "1567", "license": "unlicense", "hash": -1409868878737299200, "line_mean": 33.0652173913, "line_max": 78, "alpha_frac": 0.6470963625, "autogenerated": false, "ratio": 3.713270142180095, "config_test": fa...
from django.test import LiveServerTestCase from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.firefox.webdriver import WebDriver class LoginTest(LiveServerTestCase): fixtures = ['users_data.json'] @classmethod def setUpClass(cls): cls.selenium = WebDriver() ...
{ "repo_name": "wiliamsouza/gunclub", "path": "gunclub/tests/selenium/login_tests.py", "copies": "1", "size": "1922", "license": "apache-2.0", "hash": -2326817338616216000, "line_mean": 35.9615384615, "line_max": 79, "alpha_frac": 0.6357960458, "autogenerated": false, "ratio": 4.0463157894736845, ...
from django.test import LiveServerTestCase, override_settings, tag from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.contrib.auth.models import User from selenium import webdriver from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.desired_capabil...
{ "repo_name": "p2pu/learning-circles", "path": "e2e/tests/test_learning_circle_creation.py", "copies": "1", "size": "9170", "license": "mit", "hash": 2555244826195940000, "line_mean": 46.0256410256, "line_max": 251, "alpha_frac": 0.7063249727, "autogenerated": false, "ratio": 3.8097216452014955, ...
from django.test import modify_settings from . import PostgreSQLTestCase from .models import CharFieldModel, TextFieldModel try: from django.contrib.postgres.search import TrigramDistance, TrigramSimilarity except ImportError: pass @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) class...
{ "repo_name": "kaedroho/django", "path": "tests/postgres_tests/test_trigram.py", "copies": "7", "size": "2133", "license": "bsd-3-clause", "hash": 5011602397825897000, "line_mean": 33.9672131148, "line_max": 94, "alpha_frac": 0.6305672761, "autogenerated": false, "ratio": 4.317813765182186, "co...
from django.test import override_settings from channels.tests import ( TransactionChannelTestCase ) from django_redis import get_redis_connection from ..decorators import task from ..consumers import run_task from ..tasks import clear_logs from .test_base import SilentMixin @task def task_a(cqt, publish=True): ...
{ "repo_name": "furious-luke/django-cq", "path": "cq/tests/test_logs.py", "copies": "1", "size": "3000", "license": "bsd-3-clause", "hash": 4453567071227006500, "line_mean": 29, "line_max": 65, "alpha_frac": 0.5766666667, "autogenerated": false, "ratio": 3.6101083032490973, "config_test": true, ...
from django.test import override_settings from django.db import NotSupportedError from django.db import models from djangae.test import TestCase class MultiQueryModel(models.Model): field1 = models.IntegerField() class AsyncMultiQueryTest(TestCase): """ Specific tests for multiquery """ def...
{ "repo_name": "grzes/djangae", "path": "djangae/tests/test_async_multi_query.py", "copies": "1", "size": "1446", "license": "bsd-3-clause", "hash": -4256224560090405000, "line_mean": 26.8076923077, "line_max": 80, "alpha_frac": 0.5975103734, "autogenerated": false, "ratio": 3.994475138121547, "...
from django.test import override_settings from django.test import TestCase from mock import call from mock import MagicMock from mock import Mock from mock import patch from sqlalchemy.engine import Engine from kolibri.core.content.utils.sqlalchemybridge import Bridge from kolibri.core.content.utils.sqlalchemybridge i...
{ "repo_name": "indirectlylit/kolibri", "path": "kolibri/core/content/test/test_sqlalchemy_bridge.py", "copies": "3", "size": "13083", "license": "mit", "hash": -3744737834013174000, "line_mean": 35.5446927374, "line_max": 87, "alpha_frac": 0.627914087, "autogenerated": false, "ratio": 3.864992614...
from django.test import override_settings from django.urls import reverse from django_webtest import WebTest from mymoney.apps.bankaccounts.factories import BankAccountFactory from mymoney.apps.banktransactiontags.factories import ( BankTransactionTagFactory, ) from mymoney.core.factories import UserFactory cla...
{ "repo_name": "ychab/mymoney", "path": "mymoney/apps/banktransactionanalytics/tests/test_forms.py", "copies": "1", "size": "3195", "license": "bsd-3-clause", "hash": 4603420786485141500, "line_mean": 30.3235294118, "line_max": 72, "alpha_frac": 0.6078247261, "autogenerated": false, "ratio": 4.133...
from django.test import override_settings from django.utils.timezone import make_aware, utc from bedrock.pocketfeed import api import datetime from mock import patch @override_settings(POCKET_API_URL='test_url', POCKET_CONSUMER_KEY='1234', POCKET_ACCESS_TOKEN='5678') @patch.object(api, 'requests'...
{ "repo_name": "kyoshino/bedrock", "path": "bedrock/pocketfeed/tests/test_api.py", "copies": "1", "size": "1816", "license": "mpl-2.0", "hash": -351120823751181600, "line_mean": 29.7796610169, "line_max": 103, "alpha_frac": 0.579845815, "autogenerated": false, "ratio": 3.661290322580645, "config...
from django.test import override_settings from pytest import mark from .fake_pretix import FAKE_PRETIX_ITEMS, FAKE_PRETIX_ORDER def _query_orders(graphql_client, conference): return graphql_client.query( """ query Orders($conference: String!) { me { orders(conference: $conference)...
{ "repo_name": "patrick91/pycon", "path": "backend/users/tests/test_user_orders.py", "copies": "1", "size": "2176", "license": "mit", "hash": 8553168179550893000, "line_mean": 28.0133333333, "line_max": 87, "alpha_frac": 0.6240808824, "autogenerated": false, "ratio": 3.4375987361769353, "config_...
from django.test import override_settings from rest_framework.test import APITestCase from rest_framework import status from django.conf import settings from django.db.models import Q from .models import User from .tokens import account_activation_token from items.models import Item, ItemInventory, ItemImage from carts...
{ "repo_name": "mikaelm1/ecommerce-api", "path": "src/authentication/tests.py", "copies": "1", "size": "7675", "license": "mit", "hash": -5363128028273680000, "line_mean": 33.5720720721, "line_max": 78, "alpha_frac": 0.5835830619, "autogenerated": false, "ratio": 3.9338800615069194, "config_test...
from django.test import override_settings from bedrock.pocketfeed import api from bedrock.pocketfeed.models import PocketArticle import json import pytest import responses from pathlib2 import Path TEST_DATA = Path(__file__).with_name('test_data') def get_test_file_content(filename): with TEST_DATA.joinpath(f...
{ "repo_name": "kyoshino/bedrock", "path": "bedrock/pocketfeed/tests/test_models.py", "copies": "1", "size": "2603", "license": "mpl-2.0", "hash": -7035599840020565000, "line_mean": 31.9493670886, "line_max": 133, "alpha_frac": 0.7172493277, "autogenerated": false, "ratio": 3.5080862533692723, "...
from django.test import override_settings from bedrock.wordpress import api from bedrock.wordpress import models import pytest import responses from pathlib2 import Path TEST_DATA = Path(__file__).with_name('test_data') TEST_WP_BLOGS = { 'firefox': { 'url': 'https://blog.mozilla.org/firefox/', '...
{ "repo_name": "MichaelKohler/bedrock", "path": "bedrock/wordpress/tests/test_models.py", "copies": "3", "size": "3872", "license": "mpl-2.0", "hash": 4886767302203043000, "line_mean": 33.5714285714, "line_max": 92, "alpha_frac": 0.6627066116, "autogenerated": false, "ratio": 3.0803500397772474, ...
from django.test import override_settings from .. import view_helpers from .base import FunctionalTest class ElementHelper(object): def __init__(self, browser): self.browser = browser @property def done(self): return self.browser.find_element_by_css_selector( '[value="{}"]'....
{ "repo_name": "scattermagic/django-wizard-builder", "path": "wizard_builder/tests/test_frontend.py", "copies": "1", "size": "6835", "license": "bsd-3-clause", "hash": 380252006887325060, "line_mean": 33.5202020202, "line_max": 73, "alpha_frac": 0.6434528164, "autogenerated": false, "ratio": 3.842...
from django.test import override_settings from mock import patch, MagicMock from nose.tools import eq_ from mozillians.common.tests import TestCase from mozillians.common.utils import akismet_spam_check class AkismetTests(TestCase): @patch('mozillians.common.utils.requests') @patch('mozillians.users.tasks.w...
{ "repo_name": "mozilla/mozillians", "path": "mozillians/common/tests/test_utils.py", "copies": "4", "size": "2889", "license": "bsd-3-clause", "hash": -8060567981600105000, "line_mean": 37.0131578947, "line_max": 75, "alpha_frac": 0.6306680512, "autogenerated": false, "ratio": 3.2941847206385404,...
from django.test import override_settings from rest_framework.test import APITestCase from .models import KeyConstructorUserProperty @override_settings(ROOT_URLCONF='tests_app.tests.functional.key_constructor.bits.urls') class ListSqlQueryKeyBitTestBehaviour(APITestCase): """Regression tests for https://github....
{ "repo_name": "chibisov/drf-extensions", "path": "tests_app/tests/functional/key_constructor/bits/tests.py", "copies": "1", "size": "1368", "license": "mit", "hash": -882096438355766500, "line_mean": 37, "line_max": 102, "alpha_frac": 0.7002923977, "autogenerated": false, "ratio": 3.8, "config_...
from django.test import override_settings from rest_framework.test import APITestCase from .models import ( NestedRouterMixinUserModel as UserModel, NestedRouterMixinGroupModel as GroupModel, NestedRouterMixinPermissionModel as PermissionModel, NestedRouterMixinTaskModel as TaskModel, NestedRouter...
{ "repo_name": "chibisov/drf-extensions", "path": "tests_app/tests/functional/routers/nested_router_mixin/tests.py", "copies": "1", "size": "18814", "license": "mit", "hash": -179971451426303170, "line_mean": 34.4981132075, "line_max": 116, "alpha_frac": 0.5491123631, "autogenerated": false, "rati...
from django.test import override_settings from sms.decorators import twilio_view from .test_sms import GarfieldTwilioTestCase @override_settings(DEBUG=False) class GarfieldSmsDecoratorsTestCase(GarfieldTwilioTestCase): def test_not_get_or_post(self): response = self.client.delete("/sms/", ...
{ "repo_name": "RobSpectre/garfield", "path": "garfield/sms/tests/test_decorators.py", "copies": "1", "size": "1812", "license": "mit", "hash": 7435675973317076000, "line_mean": 35.24, "line_max": 68, "alpha_frac": 0.5954746137, "autogenerated": false, "ratio": 3.9391304347826086, "config_test":...
from django.test import override_settings, RequestFactory import pytest import responses from bedrock.wordpress.models import BlogPost from bedrock.wordpress.tests.test_models import setup_responses, TEST_WP_BLOGS from bedrock.wordpress.views import BlogPostsView @responses.activate @override_settings(WP_BLOGS=TEST...
{ "repo_name": "alexgibson/bedrock", "path": "bedrock/wordpress/tests/test_views.py", "copies": "15", "size": "2306", "license": "mpl-2.0", "hash": 5097041178957797000, "line_mean": 34.4769230769, "line_max": 83, "alpha_frac": 0.6248915872, "autogenerated": false, "ratio": 3.6087636932707357, "c...
from django.test import override_settings, SimpleTestCase from django.test.client import RequestFactory from django.template import TemplateDoesNotExist from django.template.loader import ( get_template, select_template, render_to_string) @override_settings(TEMPLATES=[{ 'BACKEND': 'django.template.backends.du...
{ "repo_name": "doismellburning/django", "path": "tests/template_loader/tests.py", "copies": "5", "size": "5215", "license": "bsd-3-clause", "hash": 8060720165182044000, "line_mean": 44.347826087, "line_max": 83, "alpha_frac": 0.6462128476, "autogenerated": false, "ratio": 4.165335463258786, "co...
from django.test import RequestFactory, Client from django_tenants.middleware import TenantMiddleware class TenantRequestFactory(RequestFactory): tm = TenantMiddleware() def __init__(self, tenant, **defaults): super(TenantRequestFactory, self).__init__(**defaults) self.tenant = tenant de...
{ "repo_name": "sigma-geosistemas/django-tenants", "path": "django_tenants/test/client.py", "copies": "1", "size": "2934", "license": "mit", "hash": 4556295657095750000, "line_mean": 35.675, "line_max": 76, "alpha_frac": 0.6209952284, "autogenerated": false, "ratio": 3.800518134715026, "config_t...
from django.test import RequestFactory, Client from django_tenants.middleware.main import TenantMainMiddleware from django.http import HttpRequest from django.contrib.auth import authenticate class TenantRequestFactory(RequestFactory): tm = TenantMainMiddleware() def __init__(self, tenant, **defaults): ...
{ "repo_name": "tomturner/django-tenants", "path": "django_tenants/test/client.py", "copies": "1", "size": "3215", "license": "mit", "hash": -3978233866627388000, "line_mean": 32.1443298969, "line_max": 87, "alpha_frac": 0.6024883359, "autogenerated": false, "ratio": 3.9496314496314495, "config_...
from django.test import RequestFactory, Client from tenant_schemas.middleware import TenantMiddleware class TenantRequestFactory(RequestFactory): tm = TenantMiddleware() def __init__(self, tenant, **defaults): super(TenantRequestFactory, self).__init__(**defaults) self.tenant = tenant de...
{ "repo_name": "alexjillard/django-tenant-schemas", "path": "tenant_schemas/test/client.py", "copies": "1", "size": "3143", "license": "mit", "hash": -1342652648616568800, "line_mean": 34.7272727273, "line_max": 76, "alpha_frac": 0.6070633153, "autogenerated": false, "ratio": 3.800483675937122, ...
from django.test import RequestFactory from django.contrib.auth.models import AnonymousUser from django.contrib.sessions.middleware import SessionMiddleware from django.template import RequestContext from django.template.response import TemplateResponse from cms.utils import get_template_from_request from . import app_...
{ "repo_name": "fscherf/django-cms-extensions", "path": "cms_extensions/utils.py", "copies": "1", "size": "2765", "license": "bsd-3-clause", "hash": 4080804368032327700, "line_mean": 29.0543478261, "line_max": 71, "alpha_frac": 0.6643761302, "autogenerated": false, "ratio": 3.984149855907781, "c...
from django.test import RequestFactory from django.http import Http404 from django.core.files.uploadedfile import SimpleUploadedFile from django.utils import timezone from nose import tools as nt import mock import csv import os from datetime import timedelta from tests.base import AdminTestCase from website import se...
{ "repo_name": "mluo613/osf.io", "path": "admin_tests/users/test_views.py", "copies": "2", "size": "14739", "license": "apache-2.0", "hash": -2380453144157235000, "line_mean": 36.7923076923, "line_max": 123, "alpha_frac": 0.6351855621, "autogenerated": false, "ratio": 3.4165507649513214, "config...
from django.test import RequestFactory from django.http import Http404 from nose import tools as nt import mock from tests.base import AdminTestCase from website import settings from framework.auth import User from tests.factories import UserFactory, AuthUserFactory, ProjectFactory from admin_tests.utilities import se...
{ "repo_name": "emetsger/osf.io", "path": "admin_tests/users/test_views.py", "copies": "1", "size": "5672", "license": "apache-2.0", "hash": -2502192852606516700, "line_mean": 34.6729559748, "line_max": 79, "alpha_frac": 0.6491537377, "autogenerated": false, "ratio": 3.608142493638677, "config_t...
from django.test import RequestFactory from django.test import override_settings from bedrock.utils import views def test_variation_template_view(): rf = RequestFactory() view = views.VariationTemplateView(template_context_variations=['b'], template_name_variations=['b'...
{ "repo_name": "hoosteeno/bedrock", "path": "bedrock/utils/tests/test_views.py", "copies": "9", "size": "2530", "license": "mpl-2.0", "hash": -1481030257389894000, "line_mean": 37.9230769231, "line_max": 76, "alpha_frac": 0.5636363636, "autogenerated": false, "ratio": 3.5886524822695036, "config...
from django.test import RequestFactory from django.test.utils import override_settings from .. import views @override_settings( LOCALE_LATEST_VERSION={ 'de': {'slug': '1-1', 'name': '1.1'}, 'en': {'slug': '1-3T', 'name': '1.3T'} }) def test_home_redirect_de(): request = RequestFactory().g...
{ "repo_name": "mozilla/masterfirefoxos", "path": "masterfirefoxos/base/tests/test_views.py", "copies": "3", "size": "1383", "license": "mpl-2.0", "hash": 3612584136962576000, "line_mean": 34.4615384615, "line_max": 82, "alpha_frac": 0.6500361533, "autogenerated": false, "ratio": 3.528061224489795...
from django.test import RequestFactory from huts.api import HutResource, AgencyResource, RegionResource from huts.models import Hut, Agency, Region request_factory = RequestFactory() def _serialize_queryset(queryset, resource): objects_data = { 'meta': { 'total_count': len(queryset)}, 'object_index': ...
{ "repo_name": "muescha/hutmap", "path": "huts/utils/export.py", "copies": "2", "size": "1089", "license": "mit", "hash": 3794282820892081700, "line_mean": 32, "line_max": 81, "alpha_frac": 0.6418732782, "autogenerated": false, "ratio": 3.8480565371024733, "config_test": false, "has_no_keyword...
from django.test import RequestFactory from main.tests.test_base import MainTestCase from api.views import DataViewSet, XFormViewSet class TestDataAPI(MainTestCase): def setUp(self): MainTestCase.setUp(self) self._create_user_and_login() self._publish_transportation_form() self._...
{ "repo_name": "eHealthAfrica/formhub", "path": "api/tests/test_data_api.py", "copies": "2", "size": "5933", "license": "bsd-2-clause", "hash": 2837425834940794400, "line_mean": 41.9927536232, "line_max": 78, "alpha_frac": 0.5937974043, "autogenerated": false, "ratio": 3.724419334588826, "config...
from django.test import RequestFactory from nose import tools as nt from tests.base import AdminTestCase from tests.factories import NodeFactory from admin_tests.utilities import setup_view from admin.nodes.views import ( NodeView, remove_node, restore_node, ) class TestNodeView(AdminTestCase): def...
{ "repo_name": "billyhunt/osf.io", "path": "admin_tests/nodes/test_views.py", "copies": "1", "size": "1772", "license": "apache-2.0", "hash": -6456462780144246000, "line_mean": 29.0338983051, "line_max": 71, "alpha_frac": 0.6343115124, "autogenerated": false, "ratio": 3.7463002114164903, "config...
from django.test import RequestFactory from nose.tools import eq_ import pyquery from ..urlresolvers import reverse from ..utils import paginate from ..helpers import paginator def test_paginated_url(): """Avoid duplicating page param in pagination.""" url = '%s?%s' % (reverse('search'), 'q=bookmarks&page=2'...
{ "repo_name": "mastizada/kuma", "path": "kuma/core/tests/test_pagination.py", "copies": "26", "size": "1355", "license": "mpl-2.0", "hash": -8070215216164012000, "line_mean": 29.1111111111, "line_max": 66, "alpha_frac": 0.6450184502, "autogenerated": false, "ratio": 3.4832904884318765, "config_...
from django.test import RequestFactory from nose.tools import eq_ import pyquery from ..urlresolvers import reverse from ..utils import paginate from ..templatetags.jinja_helpers import paginator def test_paginated_url(): """Avoid duplicating page param in pagination.""" url = '%s?%s' % (reverse('search'), '...
{ "repo_name": "openjck/kuma", "path": "kuma/core/tests/test_pagination.py", "copies": "1", "size": "1374", "license": "mpl-2.0", "hash": -2442718590414694400, "line_mean": 29.5333333333, "line_max": 66, "alpha_frac": 0.6484716157, "autogenerated": false, "ratio": 3.487309644670051, "config_test...
from django.test import RequestFactory from test_plus.test import TestCase from permabots.test.factories import BotFactory, HandlerFactory, HookFactory, UrlParamFactory, \ HeaderParamFactory, TelegramRecipientFactory, StateFactory, KikRecipientFactory, MessengerRecipientFactory from permabots.models import (Environ...
{ "repo_name": "jlmadurga/permabots-www", "path": "permabots_www/tests/test_views.py", "copies": "1", "size": "34806", "license": "mit", "hash": 8198382326977755000, "line_mean": 37.0404371585, "line_max": 116, "alpha_frac": 0.5904441763, "autogenerated": false, "ratio": 3.7927427263811704, "con...
from django.test import RequestFactory from django_cas_ng.views import ( _service_url, _redirect_url, _login_url, _logout_url, ) # # _service_url tests # def test_service_url_helper(): factory = RequestFactory() request = factory.get('/login/') actual = _service_url(request) expected...
{ "repo_name": "forcityplatform/django-cas-ng", "path": "tests/test_views_helpers.py", "copies": "1", "size": "4991", "license": "mit", "hash": 8699263055481135000, "line_mean": 26.2732240437, "line_max": 96, "alpha_frac": 0.67902224, "autogenerated": false, "ratio": 3.5123152709359604, "config_...
from django.test import RequestFactory from kuma.api.v1.search.forms import SearchForm def test_search_form_locale_happy_path(): """The way the form handles 'locale' is a bit overly complicated. These unit tests focuses exclusively on that and when the form is valid.""" initial = {"page": 1, "size": 10}...
{ "repo_name": "escattone/kuma", "path": "kuma/api/v1/tests/test_forms.py", "copies": "1", "size": "2198", "license": "mpl-2.0", "hash": 1159120526851464200, "line_mean": 37.5614035088, "line_max": 83, "alpha_frac": 0.6742493176, "autogenerated": false, "ratio": 3.494435612082671, "config_test":...
from django.test import RequestFactory from kuma.core.tests import KumaTestCase, eq_ from ..middleware import SetRemoteAddrFromForwardedFor class TrailingSlashMiddlewareTestCase(KumaTestCase): def test_no_trailing_slash(self): response = self.client.get(u'/en-US/ohnoez') eq_(response.status_code,...
{ "repo_name": "jgmize/kuma", "path": "kuma/core/tests/test_middleware.py", "copies": "3", "size": "1330", "license": "mpl-2.0", "hash": -336848058180560100, "line_mean": 34, "line_max": 76, "alpha_frac": 0.6481203008, "autogenerated": false, "ratio": 3.107476635514019, "config_test": true, "h...
from django.test import RequestFactory from mock import patch, MagicMock from nose.tools import ok_ from mozillians.common.tests import TestCase from mozillians.groups.models import Group, GroupAlias, GroupMembership from mozillians.groups.tests import GroupFactory from mozillians.groups.views import show, group_dele...
{ "repo_name": "chirilo/mozillians", "path": "mozillians/groups/tests/test_views/test_delete.py", "copies": "3", "size": "5152", "license": "bsd-3-clause", "hash": 5110384435508293000, "line_mean": 34.5310344828, "line_max": 89, "alpha_frac": 0.6519798137, "autogenerated": false, "ratio": 4.101910...
from django.test import RequestFactory from nose.tools import eq_, ok_ from nose.plugins.attrib import attr from kuma.users.tests import UserTestCase from ..forms import RevisionForm, TreeMoveForm from ..tests import doc_rev, normalize_html class FormEditorSafetyFilterTests(UserTestCase): @attr('bug821986') ...
{ "repo_name": "groovecoder/kuma", "path": "kuma/wiki/tests/test_forms.py", "copies": "5", "size": "4210", "license": "mpl-2.0", "hash": 1359203984835545600, "line_mean": 30.4179104478, "line_max": 86, "alpha_frac": 0.5042755344, "autogenerated": false, "ratio": 3.6199484092863283, "config_test"...
from django.test import RequestFactory from nose.tools import eq_, ok_ from nose.plugins.attrib import attr from kuma.users.tests import UserTestCase from ..forms import RevisionForm, TreeMoveForm from ..tests import normalize_html, revision class FormEditorSafetyFilterTests(UserTestCase): @attr('bug821986') ...
{ "repo_name": "robhudson/kuma", "path": "kuma/wiki/tests/test_forms.py", "copies": "1", "size": "5239", "license": "mpl-2.0", "hash": -4136075166798920700, "line_mean": 30.7515151515, "line_max": 86, "alpha_frac": 0.5121206337, "autogenerated": false, "ratio": 3.705091937765205, "config_test": ...
from django.test import RequestFactory from olympia.amo.tests import TestCase, user_factory from olympia.devhub.permissions import IsSubmissionAllowedFor from olympia.users.models import ( DisposableEmailDomainRestriction, EmailUserRestriction, IPNetworkUserRestriction) class TestIsSubmissionAllowedFor(TestC...
{ "repo_name": "bqbn/addons-server", "path": "src/olympia/devhub/tests/test_permissions.py", "copies": "2", "size": "3702", "license": "bsd-3-clause", "hash": -1002667196825543600, "line_mean": 48.36, "line_max": 79, "alpha_frac": 0.6866558617, "autogenerated": false, "ratio": 3.9892241379310347, ...
from django.test import RequestFactory from onadata.apps.api.viewsets.note_viewset import NoteViewSet from onadata.apps.main.tests.test_base import TestBase class TestNoteViewSet(TestBase): def setUp(self): super(self.__class__, self).setUp() self._create_user_and_login() self._publish_t...
{ "repo_name": "eHealthAfrica/onadata", "path": "onadata/apps/api/tests/viewsets/test_note_viewset.py", "copies": "12", "size": "3593", "license": "bsd-2-clause", "hash": 7553799365553186000, "line_mean": 36.0412371134, "line_max": 75, "alpha_frac": 0.6031171723, "autogenerated": false, "ratio": 3...
from django.test import RequestFactory from test_plus.test import TestCase from ..adapters import AccountAdapter, SocialAccountAdapter from django.test import override_settings from ..views import ( UserRedirectView, UserUpdateView ) class BaseUserTestCase(TestCase): def setUp(self): self.user ...
{ "repo_name": "frRoy/Benchmarklib", "path": "benchmarklib/users/tests/test_views.py", "copies": "1", "size": "2705", "license": "bsd-3-clause", "hash": -6718386154518505000, "line_mean": 30.4534883721, "line_max": 76, "alpha_frac": 0.6369685767, "autogenerated": false, "ratio": 4.1937984496124034...
from django.test import RequestFactory from test_plus.test import TestCase from ..views import ( EventUpdate, EventCreate ) class BaseUserTestCase(TestCase): def setUp(self): self.user = self.make_user() self.factory = RequestFactory() class TestEventUpdateView(BaseUserTestCase): ...
{ "repo_name": "mansonul/events", "path": "events/tests/test_views.py", "copies": "1", "size": "1794", "license": "mit", "hash": -3127013413012833000, "line_mean": 27.03125, "line_max": 73, "alpha_frac": 0.6153846154, "autogenerated": false, "ratio": 4.231132075471698, "config_test": true, "ha...
from django.test import RequestFactory from test_plus.test import TestCase from ..views import ( UserRedirectView, UserUpdateView ) class BaseUserTestCase(TestCase): def setUp(self): self.user = self.make_user() self.factory = RequestFactory() class TestUserRedirectView(BaseUserTestCa...
{ "repo_name": "jlmadurga/permabots-www", "path": "permabots_www/users/tests/test_views.py", "copies": "1", "size": "1830", "license": "mit", "hash": -5521748099715559000, "line_mean": 27.59375, "line_max": 73, "alpha_frac": 0.6098360656, "autogenerated": false, "ratio": 4.265734265734266, "conf...
from django.test import RequestFactory from test_plus.test import TestCase from ..views import UserUpdateView class BaseUserTestCase(TestCase): def setUp(self): self.user = self.make_user() self.factory = RequestFactory() class TestUserUpdateView(BaseUserTestCase): def setUp(self): ...
{ "repo_name": "savioabuga/phoenix", "path": "phoenix/users/tests/test_views.py", "copies": "1", "size": "1184", "license": "bsd-3-clause", "hash": 5717349398192965000, "line_mean": 27.1904761905, "line_max": 73, "alpha_frac": 0.6190878378, "autogenerated": false, "ratio": 4.228571428571429, "co...
from django.test import RequestFactory, override_settings from mock import Mock from basket.news.middleware import EnforceHostnameMiddleware, is_ip_address def test_is_ip_address(): assert is_ip_address('1.2.3.4') assert is_ip_address('192.168.1.1') assert not is_ip_address('basket.mozilla.org') ass...
{ "repo_name": "glogiotatidis/basket", "path": "basket/news/tests/test_middleware.py", "copies": "1", "size": "1401", "license": "mpl-2.0", "hash": -3229724487304746500, "line_mean": 32.3571428571, "line_max": 75, "alpha_frac": 0.6609564597, "autogenerated": false, "ratio": 3.3677884615384617, "...
from django.test import RequestFactory, TestCase, modify_settings from distutils.version import LooseVersion from wagtail.core import __version__ as wagtail_version from wagtail.core.models import Page, Site from wagtailmenus.conf import defaults from wagtailmenus.utils.misc import derive_page, derive_section_root, ge...
{ "repo_name": "ababic/wagtailmenus", "path": "wagtailmenus/utils/tests/test_misc.py", "copies": "2", "size": "10973", "license": "mit", "hash": 4318085438708287500, "line_mean": 38.0498220641, "line_max": 91, "alpha_frac": 0.6056684589, "autogenerated": false, "ratio": 3.839398180545836, "confi...
from django.test import RequestFactory, TestCase import jwt from django.conf import settings from ..middleware import authenticate from django.contrib.auth import get_user_model def generate_jwt_token(shop): return jwt.encode( { "iss": f"https://{shop.myshopify_domain}", "dest": f"...
{ "repo_name": "discolabs/django-shopify-auth", "path": "shopify_auth/session_tokens/tests/test_authentication.py", "copies": "1", "size": "1859", "license": "mit", "hash": -1424317816119718700, "line_mean": 33.4259259259, "line_max": 76, "alpha_frac": 0.6530392684, "autogenerated": false, "ratio"...
from django.test import RequestFactory, TestCase, override_settings from django.utils.encoding import force_bytes from wagtail.core.models import Site from ..utils import FieldsParameterParseError, get_base_url, parse_boolean, parse_fields_parameter class DynamicBaseUrl: def __str__(self): return 'https...
{ "repo_name": "zerolab/wagtail", "path": "wagtail/api/v2/tests/tests.py", "copies": "7", "size": "11951", "license": "bsd-3-clause", "hash": 3851922756627767000, "line_mean": 33.1457142857, "line_max": 105, "alpha_frac": 0.6346749226, "autogenerated": false, "ratio": 4.019845274133871, "config_...
from django.test import SimpleTestCase from corehq.apps.app_manager.tests.app_factory import AppFactory from corehq.apps.app_manager.tests.util import TestXmlMixin class ShadowModuleFormSelectionSuiteTest(SimpleTestCase, TestXmlMixin): def setUp(self): self.factory = AppFactory() self.basic_modul...
{ "repo_name": "qedsoftware/commcare-hq", "path": "corehq/apps/app_manager/tests/test_shadow_modules.py", "copies": "1", "size": "4232", "license": "bsd-3-clause", "hash": 2434757221782835000, "line_mean": 29.8905109489, "line_max": 112, "alpha_frac": 0.5241020794, "autogenerated": false, "ratio":...
from django.test import SimpleTestCase from corehq.apps.app_manager.xpath import XPath, CaseSelectionXPath, LedgerdbXpath, CaseTypeXpath class XPathTest(SimpleTestCase): def test_paren(self): xp = XPath('/data/q1') self.assertEqual('/data/q1', xp.paren()) self.assertEqual('(/data/q1)', xp...
{ "repo_name": "qedsoftware/commcare-hq", "path": "corehq/apps/app_manager/tests/test_xpath.py", "copies": "1", "size": "3371", "license": "bsd-3-clause", "hash": -709985933348491400, "line_mean": 34.8617021277, "line_max": 114, "alpha_frac": 0.5609611391, "autogenerated": false, "ratio": 3.298434...
from django.test import SimpleTestCase from corehq.apps.locations.models import Location from corehq.apps.locations.fixtures import LocationSet class LocationSetTest(SimpleTestCase): def test_duplicate_locations(self): location1 = Location( _id="1", name="Some Parent Location", ...
{ "repo_name": "benrudolph/commcare-hq", "path": "corehq/apps/locations/tests/test_location_set.py", "copies": "1", "size": "1042", "license": "bsd-3-clause", "hash": -4619672744060948000, "line_mean": 33.7333333333, "line_max": 62, "alpha_frac": 0.6295585413, "autogenerated": false, "ratio": 4.00...
from django.test import SimpleTestCase from corehq.apps.locations.models import SQLLocation, LocationType from corehq.apps.locations.fixtures import LocationSet class LocationSetTest(SimpleTestCase): def test_duplicate_locations(self): parent = LocationType( domain="test-domain", ...
{ "repo_name": "qedsoftware/commcare-hq", "path": "corehq/apps/locations/tests/test_location_set.py", "copies": "1", "size": "1417", "license": "bsd-3-clause", "hash": 426924351839910600, "line_mean": 29.8043478261, "line_max": 66, "alpha_frac": 0.586450247, "autogenerated": false, "ratio": 4.2172...
from django.test import SimpleTestCase from corehq.apps.reports.filters.api import paginate_options class TestEmwfPagination(SimpleTestCase): def make_data_source(self, options): def matching_objects(query): if not query: return options return [o for o in options if...
{ "repo_name": "puttarajubr/commcare-hq", "path": "corehq/apps/reports/tests/test_filters.py", "copies": "1", "size": "1868", "license": "bsd-3-clause", "hash": 5951991843977694000, "line_mean": 32.9636363636, "line_max": 75, "alpha_frac": 0.5835117773, "autogenerated": false, "ratio": 3.585412667...
from django.test import SimpleTestCase from corehq.apps.userreports.exceptions import BadSpecError from corehq.apps.userreports.filters import ANDFilter, ORFilter, NOTFilter from corehq.apps.userreports.filters.factory import FilterFactory class PropertyMatchFilterTest(SimpleTestCase): def get_filter(self): ...
{ "repo_name": "benrudolph/commcare-hq", "path": "corehq/apps/userreports/tests/test_filters.py", "copies": "2", "size": "12424", "license": "bsd-3-clause", "hash": -3022553852967472600, "line_mean": 32.7608695652, "line_max": 98, "alpha_frac": 0.5004024469, "autogenerated": false, "ratio": 4.1316...
from django.test import SimpleTestCase from corehq.apps.userreports.expressions.getters import DictGetter, NestedDictGetter, TransformedGetter class Foo(object): # helper class used in tests @property def foo(self): return 'success' class DictGetterTest(SimpleTestCase): def setUp(self): ...
{ "repo_name": "puttarajubr/commcare-hq", "path": "corehq/apps/userreports/tests/test_getters.py", "copies": "2", "size": "2068", "license": "bsd-3-clause", "hash": -6845644551074028000, "line_mean": 26.5733333333, "line_max": 103, "alpha_frac": 0.58172147, "autogenerated": false, "ratio": 3.97692...