@@ -435,3 +435,36 @@ def test_scale_without_build_should_error(self):
435435 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
436436 self .assertEqual (response .status_code , 400 )
437437 self .assertEqual (response .data , "No build associated with this release" )
438+
439+ def test_command_good (self ):
440+ """Test the default command for each container workflow"""
441+ url = '/v1/apps'
442+ response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
443+ self .assertEqual (response .status_code , 201 )
444+ app_id = response .data ['id' ]
445+ app = App .objects .get (id = app_id )
446+ user = User .objects .get (username = 'autotest' )
447+ build = Build .objects .create (owner = user ,
448+ app = app ,
449+ image = "qwerty" ,
450+ procfile = {'web' : 'node server.js' ,
451+ 'worker' : 'node worker.js' })
452+ # create an initial release
453+ release = Release .objects .create (version = 2 ,
454+ owner = user ,
455+ app = app ,
456+ config = app .config_set .latest (),
457+ build = build )
458+ # create a container
459+ c = Container .objects .create (owner = user ,
460+ app = app ,
461+ release = release ,
462+ type = 'web' ,
463+ num = 1 )
464+ self .assertEqual (c ._command , "bash -c 'node server.js'" )
465+ c .type = 'worker'
466+ self .assertEqual (c ._command , "bash -c 'node worker.js'" )
467+ c .release .build .procfile = None
468+ self .assertEqual (c ._command , 'start worker' )
469+ c .type = 'cmd'
470+ self .assertEqual (c ._command , '' )
0 commit comments