From f1d3e269b87bdbfa10997606c04916bc3f36edfb Mon Sep 17 00:00:00 2001 From: ReemMahmoud Date: Wed, 2 May 2018 14:38:52 +0200 Subject: Add unique names test cases Change-Id: I3f314ec3b3e88839c77a93ea016c10c0a31d10b1 --- python_moondb/tests/unit_python/test_pdp.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'python_moondb/tests/unit_python/test_pdp.py') diff --git a/python_moondb/tests/unit_python/test_pdp.py b/python_moondb/tests/unit_python/test_pdp.py index 5134c0fb..942d98a3 100755 --- a/python_moondb/tests/unit_python/test_pdp.py +++ b/python_moondb/tests/unit_python/test_pdp.py @@ -93,6 +93,19 @@ def test_add_pdp_twice_with_same_id(db): assert str(exception_info.value) == '409: Pdp Error' +def test_add_pdp_twice_with_same_name(db): + value = { + "name": "test_pdp", + "security_pipeline": ["policy_id_1", "policy_id_2"], + "keystone_project_id": "keystone_project_id1", + "description": "...", + } + add_pdp(value=value) + with pytest.raises(Exception) as exception_info: + add_pdp(value=value) + assert str(exception_info.value) == '409: Pdp Error' + + def test_get_pdp(db): pdp_id = "pdp_id1" value = { -- cgit 1.2.3-korg