Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • djangoldp-packages/djangoldp
  • decentral1se/djangoldp
  • femmefaytale/djangoldp
  • jvtrudel/djangoldp
4 results
Show changes
Showing
with 2088 additions and 514 deletions
This diff is collapsed.
This diff is collapsed.
Machine,Date,Auth,WithPermsCache,volume,test+AF8-get+AF8-resource,test+AF8-get+AF8-container,test+AF8-get+AF8-filtered+AF8-fields,test+AF8-get+AF8-reverse+AF8-filtered+AF8-fields,test+AF8-get+AF8-nested,test+AF8-get+AF8-users+AF8-container,Prefetch,default depth
jbl+AC0-T440p,Sep 22 2020 10:50:51,False,False,200,0.003339644670486,0.006944504976273,0.038935685157776,0.024031536579132,0.000708421468735,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:51:46,False,False,200,0.0035072016716,0.006944673061371,0.039835988283157,0.025360778570175,0.000757339000702,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:52:42,False,False,200,0.003284044265747,0.006942090988159,0.038870732784271,0.023859632015228,0.000705161094666,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:53:16,False,False,100,0.003656179904938,0.005776383876801,0.025797350406647,0.01539302110672,0.000770201683044,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:53:33,False,False,100,0.003554759025574,0.005703027248383,0.024777753353119,0.015221126079559,0.000770528316498,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:53:49,False,False,100,0.003367004394531,0.005602278709412,0.023594326972962,0.014168989658356,0.000726828575134,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:54:03,False,False,50,0.003355793952942,0.005232772827148,0.016062431335449,0.009248399734497,0.000776686668396,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:54:09,False,False,50,0.003454508781433,0.005315055847168,0.016247057914734,0.009447617530823,0.00073832988739,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:54:15,False,False,50,0.003420171737671,0.005717425346375,0.016275815963745,0.009424614906311,0.001325125694275,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:57:41,False,False,300,0.003357520103455,0.009047945340474,0.055130259990692,0.033688295682271,0.000706691741943,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 10:59:35,False,False,300,0.003680046399434,0.009138919512431,0.056478141943614,0.0363059147199,0.000769446690877,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:01:29,False,False,300,0.003643860816956,0.008885918458303,0.059775860309601,0.035221153100332,0.000756018956502,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:47:40,False,False,100,0.003384988307953,0.006034939289093,0.024095425605774,0.014140074253082,0.000722093582153,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:47:57,False,False,100,0.003611071109772,0.005775241851807,0.023724327087402,0.014749829769135,0.000745611190796,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:48:15,False,False,100,0.003316740989685,0.005551462173462,0.023505146503449,0.014274184703827,0.000737235546112,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:51:06,False,False,200,0.003252120018005,0.006922056674957,0.038872839212418,0.025012502670288,0.000715854167938,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:52:07,False,False,200,0.003315222263336,0.007173013687134,0.039467182159424,0.0239526450634,0.000736322402954,,FALSE,0
jbl+AC0-T440p,Sep 22 2020 11:53:59,False,False,200,0.003276619911194,0.006898198127747,0.038627609014511,0.023467609882355,0.000708512067795,,FALSE,0
jbl+AC0-T440p,Sep 23 2020 15:19:39,True,False,100,0.006617827415466,0.245147013664246,0.261345520019531,0.209938230514526,0.001274492740631,0.01203465461731,TRUE,0
jbl+AC0-T440p,Sep 23 2020 15:23:58,True,False,100,0.006518981456757,0.263970799446106,0.139407794475555,0.113074848651886,0.001235642433167,0.642078399658203,TRUE,0
jbl+AC0-T440p,Sep 23 2020 15:25:33,True,False,100,0.006539282798767,0.263329057693481,0.143536510467529,0.115545327663422,0.00125715970993,0.520937442779541,TRUE,0
jbl+AC0-T440p,Sep 23 2020 15:47:31,True,True,100,0.003864502906799,0.019258742332459,0.01636646270752,0.008915212154388,0.000782597064972,0.354249000549316,TRUE,0
jbl+AC0-T440p,Sep 23 2020 15:48:30,True,True,100,0.003590517044067,0.019879310131073,0.016916983127594,0.009615495204926,0.000798478126526,0.364127635955811,TRUE,0
jbl+AC0-T440p,Sep 23 2020 15:49:19,True,True,100,0.003716588020325,0.023860175609589,0.016380727291107,0.009003615379334,0.000774307250977,0.35044002532959,TRUE,0
jbl+AC0-T440p,Sep 23 2020 16:56:57,True,True,100,0.004425497055054,0.019956090450287,0.017114706039429,0.010911240577698,0.000832149982452,0.336694478988647,TRUE,0
jbl+AC0-T440p,Sep 23 2020 16:57:23,True,True,100,0.004397692680359,0.021222379207611,0.01826550245285,0.010625832080841,0.000812151432037,0.344640016555786,TRUE,0
jbl+AC0-T440p,Sep 23 2020 16:57:45,True,True,100,0.004602279663086,0.020297501087189,0.017129955291748,0.010850946903229,0.000865814685822,0.339866161346436,TRUE,0
jbl+AC0-T440p,Sep 23 2020 16:58:37,True,True,200,0.004463336467743,0.036689649820328,0.025502071380615,0.015932221412659,0.000898872613907,0.681740045547485,TRUE,0
jbl+AC0-T440p,Sep 23 2020 16:59:37,True,True,200,0.004517335891724,0.036278907060623,0.025654143095017,0.01576028585434,0.000849905014038,0.660790681838989,TRUE,0
jbl+AC0-T440p,Sep 23 2020 17:14:05,True,False,100,0.006808481216431,0.252511320114136,0.139744215011597,0.111351528167725,0.001188087463379,0.564764976501465,TRUE,0
jbl+AC0-T440p,Sep 23 2020 17:16:58,True,False,100,0.006502165794373,0.242799952030182,0.137602522373199,0.108403618335724,0.001143708229065,0.556174516677856,TRUE,0
jbl+AC0-T440p,Sep 24 2020 06:53:53,True,False,100,0.007479875087738,0.252197952270508,0.141312582492828,0.109222292900085,0.001601278781891,0.52592396736145,TRUE,0
jbl+AC0-T440p,Sep 24 2020 06:56:06,True,False,100,0.020340206623077,1.31586099863052,0.729812262058258,0.577438371181488,0.00078241109848,1.78533124923706,FALSE,0
jbl+AC0-T440p,Sep 24 2020 07:04:00,True,False,100,0.006233677864075,0.242916750907898,0.135480484962463,0.10392139673233,0.000762076377869,0.569819927215576,TRUE,0
jbl+AC0-T440p,Sep 24 2020 07:05:19,True,True,100,0.006471273899078,0.023659512996674,0.020732533931732,0.015365273952484,0.000769484043121,0.549034357070923,FALSE,0
jbl+AC0-T440p,Sep 24 2020 07:05:50,True,True,100,0.005183663368225,0.021180493831635,0.016473467350006,0.010494797229767,0.000771188735962,0.321053028106689,TRUE,0
jbl+AC0-T440p,Sep 24 2020 07:33:51,True,True,100,0.004018228054047,0.019896368980408,0.024588730335236,0.015463829040527,0.000797684192657,0.375835657119751,TRUE,0
jbl+AC0-T440p,Oct 08 2020 15:01:01,True,True,100,0.004086337089539,0.022444577217102,1.26581408977509,0.014725821018219,0.002466685771942,0.310548305511475,TRUE,1
jbl+AC0-T440p,Oct 08 2020 15:25:42,True,True,100,0.004928917884827,0.020494124889374,1.19440255403519,0.01545866727829,0.000807287693024,0.304153442382812,TRUE,1
jbl+AC0-T440p,Oct 08 2020 15:44:13,True,True,100,0.00410740852356,0.020648219585419,1.24338629007339,0.01569117307663,0.00077033996582,0.33369255065918,TRUE,1
jbl+AC0-T440p,Oct 08 2020 16:19:05,True,True,100,0.004798595905304,0.022070643901825,1.24563392400742,0.015214123725891,0.000787632465363,0.333659410476685,TRUE,1
jbl+AC0-T440p,Oct 09 2020 11:23:54,True,True,100,0.004018263816834,0.020824022293091,1.16614150524139,0.015614166259766,0.000755190849304,0.34318208694458,TRUE,1
jbl+AC0-T440p,Oct 09 2020 11:54:15,True,True,100,0.003045120239258,0.005557940006256,0.009205477237701,0.003398790359497,0.00073746919632,0.356267929077148,TRUE,1
jbl+AC0-T440p,Oct 09 2020 11:56:19,True,True,100,0.003119325637817,0.005602471828461,0.009082851409912,0.003396863937378,0.000744948387146,0.303446769714356,TRUE,2
jbl+AC0-T440p,Oct 09 2020 11:58:22,True,True,100,0.003008058071136,0.005401248931885,0.010658957958222,0.003909242153168,0.000718443393707,0.301162958145142,TRUE,3
jbl+AC0-T440p,Oct 09 2020 11:59:16,True,True,100,0.003015418052673,0.005526115894318,0.010740044116974,0.00400491476059,0.000724492073059,0.313828229904175,TRUE,4
jbl+AC0-T440p,Oct 09 2020 12:00:32,True,True,100,0.002969658374786,0.005434756278992,0.018136837482452,0.003030817508698,0.000726938247681,0.320115327835083,TRUE,0
jbl+AC0-T440p,Oct 09 2020 12:21:00,True,True,100,0.003493466377258,0.006103293895721,0.01923253774643,0.003091294765472,0.000737550258636,0.369867086410522,TRUE,0
jbl+AC0-T440p,Oct 15 2020 22:00:10,True,True,100,0.003004941940308,0.00546817779541,0.018348352909088,0.003068554401398,0.000729415416718,0.320573329925537,TRUE,0
jbl+AC0-T440p,Oct 15 2020 22:15:26,True,True,100,0.003350086212158,0.005898218154907,0.011625332832337,0.004264788627625,0.000795011520386,0.319289922714233,TRUE,1
import sys
import yaml
import django
from django.conf import settings as django_settings
from djangoldp.conf.ldpsettings import LDPSettings
from djangoldp.tests.server_settings import yaml_config
# load test config
config = yaml.safe_load(yaml_config)
ldpsettings = LDPSettings(config)
django_settings.configure(ldpsettings,
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': None
},
ANONYMOUS_USER_NAME=None)
django.setup()
from django.test.runner import DiscoverRunner
test_runner = DiscoverRunner(verbosity=1)
failures = test_runner.run_tests([
# 'djangoldp.tests.tests_performance',
'djangoldp.tests.tests_perf_get'
])
if failures:
sys.exit(failures)
from djangoldp.filters import BaseFilterBackend
from djangoldp.permissions import LDPBasePermission
class StartsWithAFilter(BaseFilterBackend):
"""Only objects whose title starts in A get through"""
def filter_queryset(self, request, queryset, view):
return queryset.filter(title__startswith='A')
class ReadOnlyStartsWithA(LDPBasePermission):
"""Only gives read-only access and only to objects which title starts with A"""
filter_backend = StartsWithAFilter
permissions = {'view', 'list'}
def check_perms(self, obj):
return getattr(obj, 'title', '').startswith('A')
def has_object_permission(self, request, view, obj=None):
return self.check_perms(obj)
def get_permissions(self, user, model, obj=None):
return self.permissions if self.check_perms(obj) else set()
class ContainsSpace(BaseFilterBackend):
"""Only objects whose title contains a space get through"""
def filter_queryset(self, request, queryset, view):
if request.user.username != 'toto':
return queryset.none()
return queryset.filter(title__contains=' ')
class Only2WordsForToto(LDPBasePermission):
"""Only gives access if the user's username is toto and only to objects whose title has two words (contains space)"""
filter_backend = ContainsSpace
def has_permission(self, request, view):
return request.user.username == 'toto'
def check_perms(self, obj):
return ' ' in getattr(obj, 'title', '')
def has_object_permission(self, request, view, obj=None):
return self.check_perms(obj)
def get_permissions(self, user, model, obj=None):
return self.permissions if self.check_perms(obj) else set()
\ No newline at end of file
import sys
import yaml
import django
from django.conf import settings
from django.conf import settings as django_settings
from djangoldp.conf.ldpsettings import LDPSettings
from djangoldp.tests.server_settings import yaml_config
settings.configure(DEBUG=False,
ALLOWED_HOSTS=["*"],
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
LDP_RDF_CONTEXT={
"@context": {
"@vocab": "http://happy-dev.fr/owl/#",
"foaf": "http://xmlns.com/foaf/0.1/",
"doap": "http://usefulinc.com/ns/doap#",
"ldp": "http://www.w3.org/ns/ldp#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"geo": "http://www.w3.org/2003/01/geo/wgs84_pos#",
"acl": "http://www.w3.org/ns/auth/acl#",
"name": "rdfs:label",
"website": "foaf:homepage",
"deadline": "xsd:dateTime",
"lat": "geo:lat",
"lng": "geo:long",
"jabberID": "foaf:jabberID",
"permissions": "acl:accessControl",
"mode": "acl:mode",
"view": "acl:Read",
"change": "acl:Write",
"add": "acl:Append",
"delete": "acl:Delete",
"control": "acl:Control"
}
},
AUTH_USER_MODEL='tests.User',
ANONYMOUS_USER_NAME = None,
AUTHENTICATION_BACKENDS=(
'django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend'),
ROOT_URLCONF='djangoldp.urls',
DJANGOLDP_PACKAGES=['djangoldp.tests'],
INSTALLED_APPS=('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'guardian',
'djangoldp',
'djangoldp.tests',
),
SEND_BACKLINKS=False,
SITE_URL='http://happy-dev.fr',
BASE_URL='http://happy-dev.fr',
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'djangoldp.pagination.LDPPagination',
'PAGE_SIZE': 5
},
)
# load test config
config = yaml.safe_load(yaml_config)
ldpsettings = LDPSettings(config)
django_settings.configure(ldpsettings)
django.setup()
from django.test.runner import DiscoverRunner
......@@ -65,11 +17,15 @@ from django.test.runner import DiscoverRunner
test_runner = DiscoverRunner(verbosity=1)
failures = test_runner.run_tests([
'djangoldp.tests.tests_settings',
'djangoldp.tests.tests_ldp_model',
'djangoldp.tests.tests_save',
'djangoldp.tests.tests_model_serializer',
'djangoldp.tests.tests_ldp_viewset',
'djangoldp.tests.tests_user_permissions',
'djangoldp.tests.tests_guardian',
'djangoldp.tests.tests_anonymous_permissions',
'djangoldp.tests.tests_permissions',
'djangoldp.tests.tests_post',
'djangoldp.tests.tests_update',
'djangoldp.tests.tests_auto_author',
'djangoldp.tests.tests_get',
......@@ -77,7 +33,8 @@ failures = test_runner.run_tests([
'djangoldp.tests.tests_sources',
'djangoldp.tests.tests_pagination',
'djangoldp.tests.tests_inbox',
#'djangoldp.tests.tests_temp'
'djangoldp.tests.tests_backlinks_service',
'djangoldp.tests.tests_cache'
])
if failures:
sys.exit(failures)
import json
import argparse
from pathlib import Path
from datetime import datetime
from utils import generate_users, generate_projects, generate_skills
'''
A script which generates and outputs random production data, into a parameterised file (json), which can be used as
a Django fixture or imported into a live database
e.g. python manage.py loaddata fixture.json
for help run python prod_data_generator.py -h
'''
# starting from offset ensures that existing users etc are not disturbed
parser = argparse.ArgumentParser(description='generates and outputs random test data, into a file used by the performance unit tests')
parser.add_argument(dest='count', metavar='N', type=int, help='the number of users (and projects) to generate')
parser.add_argument('--offset', dest='offset', type=int, default=100, help='an offset to start primary keys at (should be larger than the largest pre-existing project/user primary key)')
parser.add_argument('-f', dest='file_dest', type=str, default="../fixtures/live.json", help='the file destination to write to')
parser.add_argument('-s', dest='generate_skills', type=bool, default=False, help='Do you want to generate skills too ?')
args = parser.parse_args()
count = args.count
OFFSET = args.offset
user_template = {
'model': 'djangoldp_account.ldpuser',
'pk': 0,
'fields': {
'username': 'john',
'email': 'jlennon@c.coop',
'password':'glassonion',
'first_name': 'John',
'last_name': 'Lennon'
}
}
project_template = {
'model': 'djangoldp_project.project',
'pk': 0,
'fields': {
'description': 'Test',
'status': 'Public',
'creationDate': str(datetime.date(datetime.now()))
}
}
skill_template = {
'model': 'djangoldp_skill.skill',
'pk': 0,
'fields': {
'name': 'PHP',
}
}
fixture = generate_users(count, user_template, offset=OFFSET)
fixture = generate_projects(count, project_template, fixture=fixture, offset=OFFSET)
if args.generate_skills:
fixture = generate_skills(count, skill_template, fixture=fixture, offset=OFFSET)
with open(Path(__file__).parent / args.file_dest, 'w') as output:
json.dump(fixture, output)
print(str(count))
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.