mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-04 21:58:54 -05:00
added sharing permission test
This commit is contained in:
@@ -106,6 +106,22 @@ def test_update(arg, request, recipe_1_s1):
|
||||
validate_recipe(j, json.loads(r.content))
|
||||
|
||||
|
||||
def test_update_share(u1_s1, u2_s1, u1_s2, recipe_1_s1):
|
||||
with scopes_disabled():
|
||||
r = u1_s1.patch(
|
||||
reverse(
|
||||
DETAIL_URL,
|
||||
args={recipe_1_s1.id}
|
||||
),
|
||||
{'shared': [{'id': auth.get_user(u1_s2).pk, 'username': auth.get_user(u1_s2).username}, {'id': auth.get_user(u2_s1).pk, 'username': auth.get_user(u2_s1).username}]},
|
||||
content_type='application/json'
|
||||
)
|
||||
response = json.loads(r.content)
|
||||
assert r.status_code == 200
|
||||
assert len(response['shared']) == 1
|
||||
assert response['shared'][0]['id'] == auth.get_user(u2_s1).pk
|
||||
|
||||
|
||||
def test_update_private_recipe(u1_s1, u2_s1, recipe_1_s1):
|
||||
r = u1_s1.patch(reverse(DETAIL_URL, args={recipe_1_s1.id}), {'name': 'test1'}, content_type='application/json')
|
||||
assert r.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user