|
16 | 16 | from taxonomy.constants import ENGLISH
|
17 | 17 | from taxonomy.emsi.client import EMSISkillsApiClient
|
18 | 18 | from taxonomy.exceptions import SkipProductProcessingError, TaxonomyAPIError
|
19 |
| -from taxonomy.models import CourseSkills, Industry, JobSkills, Skill, Translation, XBlockSkillData, XBlockSkills |
| 19 | +from taxonomy.models import CourseSkills, Industry, Job, JobSkills, Skill, Translation, XBlockSkillData, XBlockSkills |
20 | 20 | from test_utils import factories
|
21 | 21 | from test_utils.constants import COURSE_KEY, PROGRAM_UUID, USAGE_KEY
|
22 | 22 | from test_utils.decorators import mock_api_response
|
@@ -1170,3 +1170,18 @@ def test_duplicate_model_instance_with_dates(self):
|
1170 | 1170 | assert original_industry.id != new_instance.id
|
1171 | 1171 | assert not hasattr(new_industry, "created")
|
1172 | 1172 | assert not hasattr(new_industry, "modified")
|
| 1173 | + |
| 1174 | + @ddt.data(None, 'some text') |
| 1175 | + @mock.patch('taxonomy.utils.chat_completion') |
| 1176 | + def test_generate_and_store_job_description(self, description, mock_chat_completion): |
| 1177 | + """ |
| 1178 | + Validate that `generate_and_store_job_description` handles a null job description correctly |
| 1179 | + """ |
| 1180 | + job = factories.JobFactory() |
| 1181 | + mock_chat_completion.return_value = description |
| 1182 | + utils.generate_and_store_job_description(job.external_id, job.name) |
| 1183 | + updated_job = Job.objects.get(external_id=job.external_id) |
| 1184 | + if description: |
| 1185 | + assert updated_job.description == description |
| 1186 | + else: |
| 1187 | + assert updated_job.description == job.description |
0 commit comments