File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -459,8 +459,9 @@ def publish(self):
459459 return data
460460
461461 def converge (self ):
462- self .publish ()
462+ databag = self .publish ()
463463 self .formation .converge ()
464+ return databag
464465
465466 def calculate (self ):
466467 """Return a representation for configuration management"""
@@ -709,8 +710,8 @@ def push(cls, push):
709710 len (app .formation .container_set .filter (type = 'web' )) < 1 :
710711 # scale an initial web containers
711712 Container .objects .scale (app , {'web' : 1 })
712- # publish the app, triggering a formation converge
713- return app .publish ()
713+ # publish and converge the application
714+ return app .converge ()
714715
715716
716717@python_2_unicode_compatible
Original file line number Diff line number Diff line change 1111
1212from django .test import TestCase
1313
14+ from api .models import Build
15+
1416# pylint: disable=R0904
1517
1618
@@ -93,3 +95,14 @@ def test_build(self):
9395 self .assertEqual (self .client .put (url ).status_code , 405 )
9496 self .assertEqual (self .client .patch (url ).status_code , 405 )
9597 self .assertEqual (self .client .delete (url ).status_code , 405 )
98+
99+ def test_build_push (self ):
100+ url = '/api/apps'
101+ body = {'formation' : 'autotest' }
102+ response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
103+ self .assertEqual (response .status_code , 201 )
104+ app_id = response .data ['id' ]
105+ # simulate a git push calling Build.push()
106+ push = {'username' : 'autotest' , 'app' : app_id }
107+ databag = Build .push (push )
108+ self .assertIn ('release' , databag )
You can’t perform that action at this time.
0 commit comments