示例#1
0
 def test_start_deployment(self, mocked):
     self._set_body_json({
         'target': {
             'cluster': None,
             'server': None
         },
         'branch': 'master',
         'commit': 'abcde'
     })
     api.environments_start_deployment(1, self.session)
示例#2
0
 def test_start_deployment_non_admin(self, mocked):
     request.account = self.session.query(m.User).filter(m.User.username == 'username').one()
     self._set_body_json({
         'target': {
             'cluster': None,
             'server': None
         },
         'branch': 'master',
         'commit': 'abcde'
     })
     api.environments_start_deployment(1, self.session)
示例#3
0
 def test_start_deployment_with_impersonating(self, mocked):
     request.account = self.session.query(m.User).filter(m.User.username == 'impersonator').one()
     request.environ['HTTP_X_IMPERSONATE_USERNAME'] = '******'
     self._set_body_json({
         'target': {
             'cluster': None,
             'server': None
         },
         'branch': 'master',
         'commit': 'abcde'
     })
     api.environments_start_deployment(1, self.session)
示例#4
0
 def test_start_deployment_with_impersonating_unprivilegied_user(self, mocked):
     request.account = self.session.query(m.User).filter(m.User.username == 'impersonator').one()
     request.environ['HTTP_X_IMPERSONATE_USERNAME'] = '******'
     self._set_body_json({
         'target': {
             'cluster': None,
             'server': None
         },
         'branch': 'master',
         'commit': 'abcde'
     })
     with self.assertRaises(HTTPError) as cm:
         api.environments_start_deployment(2, self.session)
         self.assertEquals(403, cm.exception.code)