@@ -541,11 +541,52 @@ def test_run_command_good(self):
541541 rc , output = c .run ('echo hi' )
542542 self .assertEqual (json .loads (output )['entrypoint' ], '/runner/init' )
543543
544+ def test_scaling_does_not_add_run_proctypes_to_structure (self ):
545+ """Test that app info doesn't show transient "run" proctypes."""
546+ url = '/v1/apps'
547+ response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
548+ self .assertEqual (response .status_code , 201 )
549+ app_id = response .data ['id' ]
550+ app = App .objects .get (id = app_id )
551+ user = User .objects .get (username = 'autotest' )
552+ # dockerfile + procfile worflow
553+ build = Build .objects .create (owner = user ,
554+ app = app ,
555+ image = "qwerty" ,
556+ procfile = {'web' : 'node server.js' ,
557+ 'worker' : 'node worker.js' },
558+ dockerfile = 'foo' ,
559+ sha = 'somereallylongsha' )
560+ # create an initial release
561+ release = Release .objects .create (version = 2 ,
562+ owner = user ,
563+ app = app ,
564+ config = app .config_set .latest (),
565+ build = build )
566+ # create a run container manually to simulate how they persist
567+ # when actually created by "deis apps:run".
568+ c = Container .objects .create (owner = user ,
569+ app = app ,
570+ release = release ,
571+ type = 'run' ,
572+ num = 1 )
573+ # scale up
574+ url = "/v1/apps/{app_id}/scale" .format (** locals ())
575+ body = {'web' : 3 }
576+ response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
577+ HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
578+ self .assertEqual (response .status_code , 204 )
579+ # test that "run" proctype isn't in the app info returned
580+ url = "/v1/apps/{app_id}" .format (** locals ())
581+ response = self .client .get (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
582+ self .assertEqual (response .status_code , 200 )
583+ self .assertNotIn ('run' , response .data ['structure' ])
584+
544585 def test_scale_with_unauthorized_user_returns_403 (self ):
545586 """An unauthorized user should not be able to access an app's resources.
546587
547588 If an unauthorized user is trying to scale an app he or she does not have access to, it
548- should return a 403. Currently, it returns a 404. FIXME!
589+ should return a 403.
549590 """
550591 url = '/v1/apps'
551592 response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
0 commit comments