Skip to content

Commit b08cb94

Browse files
authored
fix: Add ReadmeBody and LicenseBody in output details of publishing app (amazon-archives#30)
1 parent a814d25 commit b08cb94

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

serverlessrepo/publish.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def _get_publish_details(actions, app_metadata_template):
249249
ApplicationMetadata.DESCRIPTION,
250250
ApplicationMetadata.HOME_PAGE_URL,
251251
ApplicationMetadata.LABELS,
252-
ApplicationMetadata.README_URL
252+
ApplicationMetadata.README_URL,
253+
ApplicationMetadata.README_BODY
253254
]
254255

255256
if CREATE_APPLICATION_VERSION in actions:

tests/unit/test_publish.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,49 @@ def test_update_application_with_passed_in_sar_client(self):
311311
self.serverlessrepo_mock.update_application.assert_not_called()
312312
self.serverlessrepo_mock.create_application_version.assert_not_called()
313313

314+
def test_create_application_with_licensebody(self):
315+
self.serverlessrepo_mock.create_application.return_value = {
316+
'ApplicationId': self.application_id
317+
}
318+
template_with_licensebody = self.template \
319+
.replace('"LicenseUrl": "s3://test-bucket/LICENSE"', '"LicenseBody": "test test"')
320+
actual_result = publish_application(template_with_licensebody)
321+
expected_result = {
322+
'application_id': self.application_id,
323+
'actions': [CREATE_APPLICATION],
324+
'details': {
325+
'Author': 'abc',
326+
'Description': 'hello world',
327+
'HomePageUrl': 'https://github.com/abc/def',
328+
'Labels': ['test1', 'test2'],
329+
'LicenseBody': 'test test',
330+
'Name': 'test-app',
331+
'ReadmeUrl': 's3://test-bucket/README.md',
332+
'SemanticVersion': '1.0.0',
333+
'SourceCodeUrl': 'https://github.com/abc/def'
334+
}
335+
}
336+
self.assertEqual(expected_result, actual_result)
337+
338+
def test_update_application_with_readmebody(self):
339+
self.serverlessrepo_mock.create_application.side_effect = self.application_exists_error
340+
template_with_readmebody = self.template \
341+
.replace('"SemanticVersion": "1.0.0"', '') \
342+
.replace('"ReadmeUrl": "s3://test-bucket/README.md"', '"ReadmeBody": "test test"')
343+
actual_result = publish_application(template_with_readmebody)
344+
expected_result = {
345+
'application_id': self.application_id,
346+
'actions': [UPDATE_APPLICATION],
347+
'details': {
348+
'Description': 'hello world',
349+
'Author': 'abc',
350+
'ReadmeBody': 'test test',
351+
'Labels': ['test1', 'test2'],
352+
'HomePageUrl': 'https://github.com/abc/def'
353+
}
354+
}
355+
self.assertEqual(expected_result, actual_result)
356+
314357

315358
class TestUpdateApplicationMetadata(TestCase):
316359
def setUp(self):

0 commit comments

Comments
 (0)