Skip to content

Commit 9aec262

Browse files
committed
fix(identity): Fix unnecessary test codes(#?58)
1 parent 3920e57 commit 9aec262

File tree

1 file changed

+0
-106
lines changed

1 file changed

+0
-106
lines changed

tests/tools/test_identity_tools.py

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -901,42 +901,6 @@ def test_create_project_success_with_all_fields(
901901
parent_id="parentproject1111111111111111111",
902902
)
903903

904-
def test_create_project_parent_disabled_failed(
905-
self, mock_get_openstack_conn_identity
906-
):
907-
"""Test creating a identity project with a parent project that is disabled."""
908-
mock_conn = mock_get_openstack_conn_identity
909-
910-
# Configure mock to raise BadRequestException
911-
mock_conn.identity.create_project.side_effect = exceptions.BadRequestException(
912-
"cannot create a project in a branch containing a disabled project",
913-
)
914-
915-
# Test create_project()
916-
identity_tools = self.get_identity_tools()
917-
918-
# Verify exception is raised
919-
with pytest.raises(
920-
exceptions.BadRequestException,
921-
match="cannot create a project in a branch containing a disabled project",
922-
):
923-
identity_tools.create_project(
924-
name="ProjectOne",
925-
description="Project One description",
926-
is_enabled=True,
927-
domain_id=None,
928-
parent_id="parentproject1111111111111111111",
929-
)
930-
931-
# Verify mock calls
932-
mock_conn.identity.create_project.assert_called_once_with(
933-
name="ProjectOne",
934-
description="Project One description",
935-
is_enabled=True,
936-
domain_id=None,
937-
parent_id="parentproject1111111111111111111",
938-
)
939-
940904
def test_create_project_without_all_fields(
941905
self, mock_get_openstack_conn_identity
942906
):
@@ -972,73 +936,3 @@ def test_create_project_without_all_fields(
972936
domain_id=None,
973937
parent_id=None,
974938
)
975-
976-
def test_create_project_domain_not_found(
977-
self, mock_get_openstack_conn_identity
978-
):
979-
"""Test creating a identity project with a domain that does not exist."""
980-
mock_conn = mock_get_openstack_conn_identity
981-
982-
# Configure mock to raise BadRequestException
983-
mock_conn.identity.create_project.side_effect = exceptions.BadRequestException(
984-
"Domain 'domain1111111111111111111111111' not found. Please check the domain ID.",
985-
)
986-
987-
# Test create_project()
988-
identity_tools = self.get_identity_tools()
989-
990-
with pytest.raises(
991-
exceptions.BadRequestException,
992-
match="Domain 'domain1111111111111111111111111' not found. Please check the domain ID.",
993-
):
994-
identity_tools.create_project(
995-
name="ProjectOne",
996-
description="Project One description",
997-
is_enabled=True,
998-
domain_id="domain1111111111111111111111111",
999-
parent_id=None,
1000-
)
1001-
1002-
# Verify mock calls
1003-
mock_conn.identity.create_project.assert_called_once_with(
1004-
name="ProjectOne",
1005-
description="Project One description",
1006-
is_enabled=True,
1007-
domain_id="domain1111111111111111111111111",
1008-
parent_id=None,
1009-
)
1010-
1011-
def test_create_project_parent_not_found(
1012-
self, mock_get_openstack_conn_identity
1013-
):
1014-
"""Test creating a identity project with a parent project that does not exist."""
1015-
mock_conn = mock_get_openstack_conn_identity
1016-
1017-
# Configure mock to raise BadRequestException
1018-
mock_conn.identity.create_project.side_effect = exceptions.BadRequestException(
1019-
"Parent project 'parentproject1111111111111111111' not found. Please check the parent project ID.",
1020-
)
1021-
1022-
# Test create_project()
1023-
identity_tools = self.get_identity_tools()
1024-
1025-
with pytest.raises(
1026-
exceptions.BadRequestException,
1027-
match="Parent project 'parentproject1111111111111111111' not found. Please check the parent project ID.",
1028-
):
1029-
identity_tools.create_project(
1030-
name="ProjectOne",
1031-
description="Project One description",
1032-
is_enabled=True,
1033-
domain_id=None,
1034-
parent_id="parentproject1111111111111111111",
1035-
)
1036-
1037-
# Verify mock calls
1038-
mock_conn.identity.create_project.assert_called_once_with(
1039-
name="ProjectOne",
1040-
description="Project One description",
1041-
is_enabled=True,
1042-
domain_id=None,
1043-
parent_id="parentproject1111111111111111111",
1044-
)

0 commit comments

Comments
 (0)