fixed test

This commit is contained in:
vabene1111
2024-08-18 14:20:09 +02:00
parent 9e671d93cb
commit 540daf2a38
3 changed files with 8 additions and 26 deletions

View File

@@ -1,19 +1 @@
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="1" skipped="0" tests="4" time="34.839" timestamp="2024-08-18T12:55:39.540620" hostname="vabene-pc"><testcase classname="cookbook.tests.api.test_api_food" name="test_list_permission[arg0]" time="26.624" /><testcase classname="cookbook.tests.api.test_api_food" name="test_list_permission[arg3]" time="26.985" /><testcase classname="cookbook.tests.api.test_api_food" name="test_list_permission[arg1]" time="27.282"><failure message="assert 200 == 403&#10; + where 200 = &lt;Response status_code=200, &quot;application/json&quot;&gt;.status_code&#10; + where &lt;Response status_code=200, &quot;application/json&quot;&gt; = &lt;bound method Client.get of &lt;django.test.client.Client object at 0x0000017B4EB67350&gt;&gt;('/api/food/')&#10; + where &lt;bound method Client.get of &lt;django.test.client.Client object at 0x0000017B4EB67350&gt;&gt; = &lt;django.test.client.Client object at 0x0000017B4EB67350&gt;.get&#10; + and '/api/food/' = reverse('api:food-list')">arg = ['g1_s1', 403]
request = &lt;FixtureRequest for &lt;Function test_list_permission[arg1]&gt;&gt;
@pytest.mark.parametrize("arg", [
['a_u', 403],
['g1_s1', 403],
['u1_s1', 200],
['a1_s1', 200],
])
def test_list_permission(arg, request):
c = request.getfixturevalue(arg[0])
&gt; assert c.get(reverse(LIST_URL)).status_code == arg[1]
E assert 200 == 403
E + where 200 = &lt;Response status_code=200, "application/json"&gt;.status_code
E + where &lt;Response status_code=200, "application/json"&gt; = &lt;bound method Client.get of &lt;django.test.client.Client object at 0x0000017B4EB67350&gt;&gt;('/api/food/')
E + where &lt;bound method Client.get of &lt;django.test.client.Client object at 0x0000017B4EB67350&gt;&gt; = &lt;django.test.client.Client object at 0x0000017B4EB67350&gt;.get
E + and '/api/food/' = reverse('api:food-list')
test_api_food.py:90: AssertionError</failure></testcase><testcase classname="cookbook.tests.api.test_api_food" name="test_list_permission[arg2]" time="27.533" /></testsuite></testsuites>
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="5" time="35.973" timestamp="2024-08-18T14:19:20.591136" hostname="vabene-pc"><testcase classname="cookbook.tests.api.test_api_space" name="test_list_permission[arg0]" time="27.231" /><testcase classname="cookbook.tests.api.test_api_space" name="test_list_permission[arg1]" time="27.784" /><testcase classname="cookbook.tests.api.test_api_space" name="test_list_permission[arg3]" time="28.126" /><testcase classname="cookbook.tests.api.test_api_space" name="test_list_permission[arg4]" time="28.153" /><testcase classname="cookbook.tests.api.test_api_space" name="test_list_permission[arg2]" time="28.177" /></testsuite></testsuites>

File diff suppressed because one or more lines are too long

View File

@@ -11,7 +11,7 @@ DETAIL_URL = 'api:space-detail'
@pytest.mark.parametrize("arg", [
['a_u', 403, 0],
['g1_s1', 200, 0],
['g1_s1', 200, 1],
['u1_s1', 200, 1],
['a1_s1', 200, 1],
['a2_s1', 200, 1],