Licence header and test case 50/14250/2
authorSwaraj Kumar <swaraj.kumar@samsung.com>
Wed, 12 Mar 2025 12:29:33 +0000 (17:59 +0530)
committerSwaraj Kumar <swaraj.kumar@samsung.com>
Fri, 14 Mar 2025 12:41:29 +0000 (12:41 +0000)
Change-Id: I8ee55995db7c4080e43d751330bd56f93eb920a5
Signed-off-by: Swaraj Kumar <swaraj.kumar@samsung.com>
tests/test_problemdetails.py [new file with mode: 0644]
trainingmgr/schemas/problemdetail_schema.py

diff --git a/tests/test_problemdetails.py b/tests/test_problemdetails.py
new file mode 100644 (file)
index 0000000..c44d5eb
--- /dev/null
@@ -0,0 +1,22 @@
+import json
+import pytest
+from flask import Flask
+from trainingmgr.schemas.problemdetail_schema import ProblemDetails
+
+@pytest.fixture
+def test_app():
+    """
+    Creates a Flask test app context for testing ProblemDetails JSON response.
+    """
+    app = Flask(__name__)
+    app.config['TESTING'] = True
+    return app.test_client()
+def test_problem_details_initialization():
+    """
+    Test that ProblemDetails initializes correctly with provided values.
+    """
+    problem = ProblemDetails(400, "Bad Request", "Invalid input data")
+    assert problem.status == 400
+    assert problem.title == "Bad Request"
+    assert problem.detail == "Invalid input data"
+
index 0453157..f05defd 100644 (file)
@@ -1,3 +1,21 @@
+# ==================================================================================
+#
+#       Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
 from flask import jsonify
 
 class ProblemDetails: