def test_file_task_attachment_name_str(self): task_id = "1234" attachment_id = "123" expected_name = "This is a string attachment name" str_name_mock = { "/tasks/{}/attachments/{}".format(task_id, attachment_id): { "name": expected_name } } actual_name = get_file_attachment_name(str_name_mock, task_id=task_id, attachment_id=attachment_id) assert actual_name == expected_name
def test_file_task_attachment_name_unicode(self): task_id = "1234" attachment_id = "123" expected_name = u'ÒÓı◊OIDÁÓØØΨ¨˝ Unicode attachment name' str_name_mock = { "/tasks/{}/attachments/{}".format(task_id, attachment_id): { "name": expected_name } } actual_name = get_file_attachment_name(str_name_mock, task_id=task_id, attachment_id=attachment_id) assert actual_name == expected_name
def test_file_artifact_attachment_name_unicode(self): inc_id = "1234" artifact_id = "123" expected_name = u'ÒÓı◊OIDÁÓØØΨ¨˝ Unicode attachment name' str_name_mock = { "/incidents/{}/artifacts/{}".format(inc_id, artifact_id): { "attachment": { "name": expected_name } } } actual_name = get_file_attachment_name(str_name_mock, incident_id=inc_id, artifact_id=artifact_id) assert actual_name == expected_name
def test_file_artifact_attachment_name_str(self): inc_id = "1234" artifact_id = "123" expected_name = "This is a string attachment name" str_name_mock = { "/incidents/{}/artifacts/{}".format(inc_id, artifact_id): { "attachment": { "name": expected_name } } } actual_name = get_file_attachment_name(str_name_mock, incident_id=inc_id, artifact_id=artifact_id) assert actual_name == expected_name
def test_file_attachment_name_error(self): with self.assertRaises(ValueError): get_file_attachment_name(None, 123) with self.assertRaises(ValueError): get_file_attachment_name(None, None, attachment_id=123)