@@ -120,3 +120,36 @@ def test_list_prompts(list_prompt_templates_mock: Mock, get_projects_projects_ge
120
120
121
121
list_prompt_templates_mock .sync .assert_called_once ()
122
122
get_projects_projects_get_mock .sync_detailed .assert_called_once ()
123
+
124
+
125
+ @patch ("galileo.projects.get_projects_projects_get" )
126
+ @patch ("galileo.prompts.get_project_templates_projects_project_id_templates_get" )
127
+ def test_get_prompt_template_found (list_prompt_templates_mock : Mock , get_projects_projects_get_mock : Mock ):
128
+ """Test get_prompt_template when template exists."""
129
+ list_prompt_templates_mock .sync .return_value = [prompt_template ()]
130
+ get_projects_projects_get_mock .sync_detailed .return_value = projects_response ()
131
+
132
+ from galileo .prompts import get_prompt_template
133
+
134
+ template = get_prompt_template (name = "andrii-good-prompt" , project = "andrii-new-project" )
135
+
136
+ assert template is not None
137
+ assert template .name == "andrii-good-prompt"
138
+ list_prompt_templates_mock .sync .assert_called_once ()
139
+ get_projects_projects_get_mock .sync_detailed .assert_called_once ()
140
+
141
+
142
+ @patch ("galileo.projects.get_projects_projects_get" )
143
+ @patch ("galileo.prompts.get_project_templates_projects_project_id_templates_get" )
144
+ def test_get_prompt_template_not_found (list_prompt_templates_mock : Mock , get_projects_projects_get_mock : Mock ):
145
+ """Test get_prompt_template when template doesn't exist."""
146
+ list_prompt_templates_mock .sync .return_value = [prompt_template ()] # Return a different template
147
+ get_projects_projects_get_mock .sync_detailed .return_value = projects_response ()
148
+
149
+ from galileo .prompts import get_prompt_template
150
+
151
+ template = get_prompt_template (name = "nonexistent-template" , project = "andrii-new-project" )
152
+
153
+ assert template is None
154
+ list_prompt_templates_mock .sync .assert_called_once ()
155
+ get_projects_projects_get_mock .sync_detailed .assert_called_once ()
0 commit comments