Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
99
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp
Commits
a88c5d79
Commit
a88c5d79
authored
4 years ago
by
Jean-Baptiste
Browse files
Options
Downloads
Patches
Plain Diff
Add failing test for Hubl #766
parent
be67e7d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!165
Sub object can't be updated
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
djangoldp/tests/runner.py
+14
-14
14 additions, 14 deletions
djangoldp/tests/runner.py
djangoldp/tests/tests_save.py
+0
-1
0 additions, 1 deletion
djangoldp/tests/tests_save.py
djangoldp/tests/tests_temp.py
+70
-10
70 additions, 10 deletions
djangoldp/tests/tests_temp.py
with
84 additions
and
25 deletions
djangoldp/tests/runner.py
+
14
−
14
View file @
a88c5d79
...
...
@@ -12,20 +12,20 @@ from django.test.runner import DiscoverRunner
test_runner
=
DiscoverRunner
(
verbosity
=
1
)
failures
=
test_runner
.
run_tests
([
'
djangoldp.tests.tests_ldp_model
'
,
'
djangoldp.tests.tests_save
'
,
'
djangoldp.tests.tests_user_permissions
'
,
'
djangoldp.tests.tests_guardian
'
,
'
djangoldp.tests.tests_anonymous_permissions
'
,
'
djangoldp.tests.tests_update
'
,
'
djangoldp.tests.tests_auto_author
'
,
'
djangoldp.tests.tests_get
'
,
'
djangoldp.tests.tests_delete
'
,
'
djangoldp.tests.tests_sources
'
,
'
djangoldp.tests.tests_pagination
'
,
'
djangoldp.tests.tests_inbox
'
,
'
djangoldp.tests.tests_backlinks_service
'
,
#
'djangoldp.tests.tests_temp'
#
'djangoldp.tests.tests_ldp_model',
#
'djangoldp.tests.tests_save',
#
'djangoldp.tests.tests_user_permissions',
#
'djangoldp.tests.tests_guardian',
#
'djangoldp.tests.tests_anonymous_permissions',
#
'djangoldp.tests.tests_update',
#
'djangoldp.tests.tests_auto_author',
#
'djangoldp.tests.tests_get',
#
'djangoldp.tests.tests_delete',
#
'djangoldp.tests.tests_sources',
#
'djangoldp.tests.tests_pagination',
#
'djangoldp.tests.tests_inbox',
#
'djangoldp.tests.tests_backlinks_service',
'
djangoldp.tests.tests_temp
'
])
if
failures
:
...
...
This diff is collapsed.
Click to expand it.
djangoldp/tests/tests_save.py
+
0
−
1
View file @
a88c5d79
...
...
@@ -318,7 +318,6 @@ class Save(TestCase):
self
.
assertEqual
(
response
.
data
[
'
circle
'
][
'
@id
'
],
"
http://testserver/circles/{}/
"
.
format
(
circle
.
pk
))
def
test_nested_container_federated
(
self
):
resource
=
Resource
.
objects
.
create
()
body
=
{
...
...
This diff is collapsed.
Click to expand it.
djangoldp/tests/tests_temp.py
+
70
−
10
View file @
a88c5d79
...
...
@@ -2,7 +2,7 @@ import json
from
guardian.shortcuts
import
assign_perm
from
.models
import
PermissionlessDummy
,
Dummy
from
.models
import
PermissionlessDummy
,
Dummy
,
Resource
,
UserProfile
from
django.contrib.auth
import
get_user_model
from
django.test
import
TestCase
from
rest_framework.test
import
APIRequestFactory
,
APIClient
...
...
@@ -33,15 +33,75 @@ class TestTemp(TestCase):
def
tearDown
(
self
):
pass
# def test_nested_container_federated_609(self):
# resource = Resource.objects.create()
# body = {
# 'http://happy-dev.fr/owl/#@id': "http://testserver/resources/{}".format(resource.pk),
# 'http://happy-dev.fr/owl/#joboffers': [
# {
# 'http://happy-dev.fr/owl/#@id': "https://external.com/job-offers/1"
# },
# {
# 'http://happy-dev.fr/owl/#@id': "https://external.com/job-offers/2"
# }
# ]
# }
#
# response = self.client.put('/resources/{}/'.format(resource.pk),
# data=json.dumps(body),
# content_type='application/ld+json')
# self.assertEqual(response.status_code, 200)
# self.assertEqual(len(response.data['joboffers']['ldp:contains']), 2)
#
# body2 = {
# 'http://happy-dev.fr/owl/#@id': "http://testserver/resources/{}".format(resource.pk),
# 'http://happy-dev.fr/owl/#joboffers': [
# {
# 'http://happy-dev.fr/owl/#@id': "https://external.com/job-offers/1"
# },
# {
# 'http://happy-dev.fr/owl/#@id': "https://external.com/job-offers/3"
# },
# {
# 'http://happy-dev.fr/owl/#@id': "https://external.com/job-offers/4"
# }
# ]
# }
# response = self.client.put('/resources/{}/'.format(resource.pk),
# data=json.dumps(body2),
# content_type='application/ld+json')
#
# self.assertEqual(response.status_code, 200)
# self.assertEqual(len(response.data['joboffers']['ldp:contains']), 3)
#
# response = self.client.put('/resources/{}/job-offers'.format(resource.pk),
# data=json.dumps(body2),
# content_type='application/ld+json')
# test with anonymous user
def
test_invalidate_cache_permissions
(
self
):
self
.
setUpLoggedInUser
()
self
.
setUpGuardianDummyWithPerms
()
response
=
self
.
client
.
get
(
'
/permissionless-dummys/{}/
'
.
format
(
self
.
dummy
.
slug
))
self
.
assertEqual
(
response
.
status_code
,
403
)
assign_perm
(
'
view
'
+
'
_
'
+
PermissionlessDummy
.
_meta
.
model_name
,
self
.
user
,
self
.
dummy
)
LDPPermissions
.
invalidate_cache
()
response
=
self
.
client
.
get
(
'
/permissionless-dummys/{}/
'
.
format
(
self
.
dummy
.
slug
))
def
test_create_sub_object_in_existing_object_with_existing_reverse_1to1_relation
(
self
):
user
=
get_user_model
().
objects
.
create
(
username
=
"
alex
"
,
password
=
"
test
"
)
profile
=
UserProfile
.
objects
.
create
(
user
=
user
,
description
=
"
user description
"
)
body
=
{
'
@id
'
:
'
/users/{}/
'
.
format
(
user
.
pk
),
"
first_name
"
:
"
Alexandre
"
,
"
last_name
"
:
"
Bourlier
"
,
"
username
"
:
"
alex
"
,
'
userprofile
'
:
{
'
@id
'
:
"
http://happy-dev.fr/userprofiles/{}/
"
.
format
(
profile
.
pk
),
'
description
'
:
"
user update
"
},
'
@context
'
:
{
"
@vocab
"
:
"
http://happy-dev.fr/owl/#
"
,
}
}
response
=
self
.
client
.
put
(
'
/users/{}/
'
.
format
(
user
.
pk
),
data
=
json
.
dumps
(
body
),
content_type
=
'
application/ld+json
'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIn
(
'
userprofile
'
,
response
.
data
)
response
=
self
.
client
.
get
(
'
/userprofiles/{}/
'
.
format
(
profile
.
pk
),
content_type
=
'
application/ld+json
'
)
self
.
assertEqual
(
response
.
data
[
'
description
'
],
"
user update
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment