@@ -311,6 +311,49 @@ def test_update_application_with_passed_in_sar_client(self):
311
311
self .serverlessrepo_mock .update_application .assert_not_called ()
312
312
self .serverlessrepo_mock .create_application_version .assert_not_called ()
313
313
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
+
314
357
315
358
class TestUpdateApplicationMetadata (TestCase ):
316
359
def setUp (self ):
0 commit comments