mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
fixed test and accidental method override
This commit is contained in:
@@ -1 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="1" time="32.909" timestamp="2025-04-10T17:28:33.096783" hostname="DESKTOP-RM10LP5"><testcase classname="cookbook.tests.api.test_api_user" name="test_user_update" time="23.032" /></testsuite></testsuites>
|
||||
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="1" skipped="0" tests="7" time="38.652" timestamp="2025-06-05T16:18:49.224969" hostname="DESKTOP-RM10LP5"><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg5]" time="27.576" /><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg2]" time="27.642" /><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg4]" time="28.101" /><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg0]" time="27.737" /><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg6]" time="28.213" /><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg3]" time="28.308"><failure message="TypeError: SyncViewSet.perform_update() missing 1 required positional argument: 'pk'">arg = ['a1_s1', 200]
|
||||
request = <FixtureRequest for <Function test_update[arg3]>>
|
||||
obj_1 = <Sync: path>
|
||||
|
||||
@pytest.mark.parametrize("arg", [
|
||||
['a_u', 403],
|
||||
['g1_s1', 403],
|
||||
['u1_s1', 403],
|
||||
['a1_s1', 200],
|
||||
['g1_s2', 403],
|
||||
['u1_s2', 403],
|
||||
['a1_s2', 404],
|
||||
])
|
||||
def test_update(arg, request, obj_1):
|
||||
c = request.getfixturevalue(arg[0])
|
||||
> print(reverse(DETAIL_URL, args={obj_1.id}))
|
||||
|
||||
test_api_sync.py:83:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
..\..\..\venv\Lib\site-packages\django\test\client.py:1054: in patch
|
||||
response = super().patch(
|
||||
..\..\..\venv\Lib\site-packages\django\test\client.py:553: in patch
|
||||
return self.generic(
|
||||
..\..\..\venv\Lib\site-packages\django\test\client.py:609: in generic
|
||||
return self.request(**r)
|
||||
..\..\..\venv\Lib\site-packages\django\test\client.py:891: in request
|
||||
self.check_exception(response)
|
||||
..\..\..\venv\Lib\site-packages\django\test\client.py:738: in check_exception
|
||||
raise exc_value
|
||||
..\..\..\venv\Lib\site-packages\django\core\handlers\exception.py:55: in inner
|
||||
response = get_response(request)
|
||||
..\..\..\venv\Lib\site-packages\django\core\handlers\base.py:197: in _get_response
|
||||
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
||||
..\..\..\venv\Lib\site-packages\django\views\decorators\csrf.py:56: in wrapper_view
|
||||
return view_func(*args, **kwargs)
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\viewsets.py:124: in view
|
||||
return self.dispatch(request, *args, **kwargs)
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\views.py:509: in dispatch
|
||||
response = self.handle_exception(exc)
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\views.py:469: in handle_exception
|
||||
self.raise_uncaught_exception(exc)
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\views.py:480: in raise_uncaught_exception
|
||||
raise exc
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\views.py:506: in dispatch
|
||||
response = handler(request, *args, **kwargs)
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\mixins.py:82: in partial_update
|
||||
return self.update(request, *args, **kwargs)
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
self = <cookbook.views.api.SyncViewSet object at 0x000001E5B35EDF70>
|
||||
request = <rest_framework.request.Request: PATCH '/api/sync/1/'>, args = ()
|
||||
kwargs = {'pk': '1'}, partial = True, instance = <Sync: path>
|
||||
serializer = SyncSerializer(<Sync: path>, context={'request': <rest_framework.request.Request: PATCH '/api/sync/1/'>, 'format': Non...ull=True, required=False)
|
||||
created_at = DateTimeField(read_only=True)
|
||||
updated_at = DateTimeField(read_only=True)
|
||||
|
||||
def update(self, request, *args, **kwargs):
|
||||
partial = kwargs.pop('partial', False)
|
||||
instance = self.get_object()
|
||||
serializer = self.get_serializer(instance, data=request.data, partial=partial)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
> self.perform_update(serializer)
|
||||
E TypeError: SyncViewSet.perform_update() missing 1 required positional argument: 'pk'
|
||||
|
||||
..\..\..\venv\Lib\site-packages\rest_framework\mixins.py:68: TypeError</failure></testcase><testcase classname="cookbook.tests.api.test_api_sync" name="test_update[arg1]" time="28.216" /></testsuite></testsuites>
|
||||
File diff suppressed because one or more lines are too long
@@ -38,14 +38,14 @@ def test_list_permission(arg, request):
|
||||
|
||||
|
||||
def test_list_space(obj_1, obj_2, a1_s1, a1_s2, space_2):
|
||||
assert len(json.loads(a1_s1.get(reverse(LIST_URL)).content)) == 2
|
||||
assert len(json.loads(a1_s2.get(reverse(LIST_URL)).content)) == 0
|
||||
assert json.loads(a1_s1.get(reverse(LIST_URL)).content)['count'] == 2
|
||||
assert json.loads(a1_s2.get(reverse(LIST_URL)).content)['count'] == 0
|
||||
|
||||
obj_1.space = space_2
|
||||
obj_1.save()
|
||||
|
||||
assert len(json.loads(a1_s1.get(reverse(LIST_URL)).content)) == 1
|
||||
assert len(json.loads(a1_s2.get(reverse(LIST_URL)).content)) == 1
|
||||
assert json.loads(a1_s1.get(reverse(LIST_URL)).content)['count'] == 1
|
||||
assert json.loads(a1_s2.get(reverse(LIST_URL)).content)['count'] == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg", [
|
||||
|
||||
@@ -80,6 +80,7 @@ def test_list_space(obj_1, obj_2, a1_s1, a1_s2, space_2):
|
||||
])
|
||||
def test_update(arg, request, obj_1):
|
||||
c = request.getfixturevalue(arg[0])
|
||||
print(reverse(DETAIL_URL, args={obj_1.id}))
|
||||
r = c.patch(reverse(DETAIL_URL, args={obj_1.id}), {'path': 'new'},
|
||||
content_type='application/json')
|
||||
response = json.loads(r.content)
|
||||
|
||||
@@ -603,7 +603,7 @@ class SyncViewSet(LoggingMixin, viewsets.ModelViewSet):
|
||||
|
||||
@extend_schema(responses=SyncLogSerializer(many=False))
|
||||
@decorators.action(detail=True, pagination_class=None, methods=['POST'], )
|
||||
def perform_update(self, request, pk):
|
||||
def query_synced_folder(self, request, pk):
|
||||
sync = get_object_or_404(Sync, pk=pk)
|
||||
|
||||
sync_log = None
|
||||
|
||||
@@ -44,7 +44,7 @@ const syncLog = ref<undefined | SyncLog>(undefined)
|
||||
function performSync() {
|
||||
let api = new ApiApi()
|
||||
|
||||
api.apiSyncPerformUpdateCreate({id: props.sync.id!, sync: props.sync}).then(r => {
|
||||
api.apiSyncQuerySyncedFolderCreate({id: props.sync.id!, sync: props.sync}).then(r => {
|
||||
syncLog.value = r
|
||||
}).catch(err => {
|
||||
useMessageStore().addError(ErrorMessageType.UPDATE_ERROR, err)
|
||||
|
||||
@@ -7,7 +7,6 @@ models/AuthToken.ts
|
||||
models/AutoMealPlan.ts
|
||||
models/Automation.ts
|
||||
models/AutomationTypeEnum.ts
|
||||
models/BaseUnitEnum.ts
|
||||
models/BookmarkletImport.ts
|
||||
models/BookmarkletImportList.ts
|
||||
models/ConnectorConfig.ts
|
||||
@@ -41,16 +40,6 @@ models/MealPlan.ts
|
||||
models/MealType.ts
|
||||
models/MethodEnum.ts
|
||||
models/NutritionInformation.ts
|
||||
models/OpenDataCategory.ts
|
||||
models/OpenDataConversion.ts
|
||||
models/OpenDataFood.ts
|
||||
models/OpenDataFoodProperty.ts
|
||||
models/OpenDataProperty.ts
|
||||
models/OpenDataStore.ts
|
||||
models/OpenDataStoreCategory.ts
|
||||
models/OpenDataUnit.ts
|
||||
models/OpenDataUnitTypeEnum.ts
|
||||
models/OpenDataVersion.ts
|
||||
models/PaginatedAutomationList.ts
|
||||
models/PaginatedBookmarkletImportListList.ts
|
||||
models/PaginatedConnectorConfigList.ts
|
||||
@@ -100,13 +89,6 @@ models/PatchedInviteLink.ts
|
||||
models/PatchedKeyword.ts
|
||||
models/PatchedMealPlan.ts
|
||||
models/PatchedMealType.ts
|
||||
models/PatchedOpenDataCategory.ts
|
||||
models/PatchedOpenDataConversion.ts
|
||||
models/PatchedOpenDataFood.ts
|
||||
models/PatchedOpenDataProperty.ts
|
||||
models/PatchedOpenDataStore.ts
|
||||
models/PatchedOpenDataUnit.ts
|
||||
models/PatchedOpenDataVersion.ts
|
||||
models/PatchedProperty.ts
|
||||
models/PatchedPropertyType.ts
|
||||
models/PatchedRecipe.ts
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,6 @@ export * from './AuthToken';
|
||||
export * from './AutoMealPlan';
|
||||
export * from './Automation';
|
||||
export * from './AutomationTypeEnum';
|
||||
export * from './BaseUnitEnum';
|
||||
export * from './BookmarkletImport';
|
||||
export * from './BookmarkletImportList';
|
||||
export * from './ConnectorConfig';
|
||||
@@ -39,16 +38,6 @@ export * from './MealPlan';
|
||||
export * from './MealType';
|
||||
export * from './MethodEnum';
|
||||
export * from './NutritionInformation';
|
||||
export * from './OpenDataCategory';
|
||||
export * from './OpenDataConversion';
|
||||
export * from './OpenDataFood';
|
||||
export * from './OpenDataFoodProperty';
|
||||
export * from './OpenDataProperty';
|
||||
export * from './OpenDataStore';
|
||||
export * from './OpenDataStoreCategory';
|
||||
export * from './OpenDataUnit';
|
||||
export * from './OpenDataUnitTypeEnum';
|
||||
export * from './OpenDataVersion';
|
||||
export * from './PaginatedAutomationList';
|
||||
export * from './PaginatedBookmarkletImportListList';
|
||||
export * from './PaginatedConnectorConfigList';
|
||||
@@ -98,13 +87,6 @@ export * from './PatchedInviteLink';
|
||||
export * from './PatchedKeyword';
|
||||
export * from './PatchedMealPlan';
|
||||
export * from './PatchedMealType';
|
||||
export * from './PatchedOpenDataCategory';
|
||||
export * from './PatchedOpenDataConversion';
|
||||
export * from './PatchedOpenDataFood';
|
||||
export * from './PatchedOpenDataProperty';
|
||||
export * from './PatchedOpenDataStore';
|
||||
export * from './PatchedOpenDataUnit';
|
||||
export * from './PatchedOpenDataVersion';
|
||||
export * from './PatchedProperty';
|
||||
export * from './PatchedPropertyType';
|
||||
export * from './PatchedRecipe';
|
||||
|
||||
Reference in New Issue
Block a user