From b713be87d5e8cea80af42c63eef22ddf1b417e39 Mon Sep 17 00:00:00 2001 From: Lorenzo Balugani Date: Sun, 2 May 2021 22:41:39 +0200 Subject: [PATCH] Fixed repo conditions --- .../nest_backend/routes/repository/repository_conditions.py | 6 +----- .../backend/nest_backend/test/repository_conditions_test.py | 5 +++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/code/backend/nest_backend/routes/repository/repository_conditions.py b/code/backend/nest_backend/routes/repository/repository_conditions.py index d8d09f8..ad815ac 100644 --- a/code/backend/nest_backend/routes/repository/repository_conditions.py +++ b/code/backend/nest_backend/routes/repository/repository_conditions.py @@ -38,13 +38,9 @@ def page_repository_conditions(rid): if not (content := request.json.get("content")): return json_error("Missing `content` parameter."), 400 - if (repo_id := request.json.get("id")) is None: - return json_error("Missing `id` parameter."), 400 - condition = Condition(content=content, type=type_) - Base.session.merge(condition) + Base.session.add(condition) - repository = Repository.query.get(repo_id) use = Uses(cid=condition.id, rid=repository.id) Base.session.merge(use) diff --git a/code/backend/nest_backend/test/repository_conditions_test.py b/code/backend/nest_backend/test/repository_conditions_test.py index 9625127..73504d6 100644 --- a/code/backend/nest_backend/test/repository_conditions_test.py +++ b/code/backend/nest_backend/test/repository_conditions_test.py @@ -1,6 +1,7 @@ -import unittest -import requests import json +import unittest + +import requests class MyTestCase(unittest.TestCase):