Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
check for initial web container in build.push
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Monroy committed Sep 17, 2013
1 parent d045377 commit 74dfe2e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions api/tests/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,28 @@ def test_build(self):
self.assertEqual(self.client.delete(url).status_code, 405)

def test_build_push(self):
"""
Simlulate a git push creating a new Build object
"""
formation_id = 'autotest'
url = '/api/formations/{formation_id}/layers'.format(**locals())
body = {'id': 'runtime', 'flavor': 'autotest', 'runtime': True, 'proxy': True}
response = self.client.post(url, json.dumps(body), content_type='application/json')
self.assertEqual(response.status_code, 201)
url = '/api/formations/{formation_id}/scale'.format(**locals())
body = {'runtime': 2}
response = self.client.post(url, json.dumps(body), content_type='application/json')
self.assertEqual(response.status_code, 200)
url = '/api/apps'
body = {'formation': 'autotest'}
body = {'formation': formation_id}
response = self.client.post(url, json.dumps(body), content_type='application/json')
self.assertEqual(response.status_code, 201)
app_id = response.data['id']
# simulate a git push calling Build.push()
push = {'username': 'autotest', 'app': app_id}
databag = Build.push(push)
self.assertIn('release', databag)
self.assertIn('version', databag['release'])
self.assertIn('containers', databag)
self.assertIn('web', databag['containers'])
self.assertIn('1', databag['containers']['web'])
self.assertEqual(databag['containers']['web']['1'], 'up')

0 comments on commit 74dfe2e

Please sign in to comment.