|
10 | 10 | Project, |
11 | 11 | ProjectAddTagBindingsOptions, |
12 | 12 | ProjectCreateOptions, |
| 13 | + ProjectListOptions, |
13 | 14 | ProjectUpdateOptions, |
14 | 15 | TagBinding, |
15 | 16 | ) |
@@ -109,6 +110,51 @@ def test_list_projects_success(self): |
109 | 110 | expected_path = f"/api/v2/organizations/{organization}/projects" |
110 | 111 | self.projects_service._list.assert_called_once_with(expected_path) |
111 | 112 |
|
| 113 | + def test_list_projects_by_tags_query_params_serialized_success(self): |
| 114 | + """Test successful serialization of project list tag filter into query parameters.""" |
| 115 | + organization = "test-org" |
| 116 | + expected_path = f"/api/v2/organizations/{organization}/projects" |
| 117 | + |
| 118 | + # Mock the _list method so we can introspect the query parameters |
| 119 | + self.projects_service._list = Mock(return_value=[]) |
| 120 | + |
| 121 | + # Call the method under test |
| 122 | + list( |
| 123 | + self.projects_service.list( |
| 124 | + organization, options=ProjectListOptions(tags={"department": "five"}) |
| 125 | + ) |
| 126 | + ) |
| 127 | + |
| 128 | + self.projects_service._list.assert_called_once_with( |
| 129 | + expected_path, |
| 130 | + params={ |
| 131 | + "filter[tagged][0][key]": "department", |
| 132 | + "filter[tagged][0][value]": "five", |
| 133 | + }, |
| 134 | + ) |
| 135 | + |
| 136 | + def test_list_projects_by_name_query_params_serialized_success(self): |
| 137 | + """Test successful serialization of project list name filter into query parameters.""" |
| 138 | + organization = "test-org" |
| 139 | + expected_path = f"/api/v2/organizations/{organization}/projects" |
| 140 | + |
| 141 | + # Mock the _list method so we can introspect the query parameters |
| 142 | + self.projects_service._list = Mock(return_value=[]) |
| 143 | + |
| 144 | + # Call the method under test |
| 145 | + list( |
| 146 | + self.projects_service.list( |
| 147 | + organization, options=ProjectListOptions(name="prj-456") |
| 148 | + ) |
| 149 | + ) |
| 150 | + |
| 151 | + self.projects_service._list.assert_called_once_with( |
| 152 | + expected_path, |
| 153 | + params={ |
| 154 | + "filter[names]": "prj-456", |
| 155 | + }, |
| 156 | + ) |
| 157 | + |
112 | 158 | def test_create_project_success(self): |
113 | 159 | """Test successful project creation""" |
114 | 160 | organization = "test-org" |
|
0 commit comments