Пример #1
0
 def test_deploy_no_args(self):
     with self.assertRaises(SystemExit):
         with get_test_app(argv=['deploy']) as app:
             try:
                 app.run()
             except NovaError as e:
                 self.assertEqual(e.message, INCORRECT_ARGS_USAGE)
Пример #2
0
 def test_stack_create_no_args(self):
     with self.assertRaises(SystemExit):
         with get_test_app(argv=['stack', 'create']) as app:
             try:
                 app.run()
             except NovaError as e:
                 self.assertEqual(e.message, INCORRECT_CREATE_ARGS_USAGE)
Пример #3
0
 def test_stack_update_no_args(self):
     with self.assertRaises(SystemExit) as exit_code:
         with get_test_app(argv=['stack', 'update']) as app:
             try:
                 app.run()
             except NovaError as e:
                 self.assertEqual(e.message, INCORRECT_UPDATE_ARGS_USAGE)
     self.assertEqual(exit_code.exception.code, 0)
Пример #4
0
 def test_no_deploy(self):
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(
         os.path.realpath(__file__))
     with get_test_app(argv=[
             'deploy', 'test-environment', 'test-stack', '--file',
             nova_descriptor_file, '--no-deployment'
     ]) as app:
         app.run()
     self.manager_provider.mock_aws_manager.create_deployment.assert_not_called(
     )
Пример #5
0
 def test_deploy(self):
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(
         os.path.realpath(__file__))
     with get_test_app(argv=[
             'deploy', 'test-environment', 'test-stack', '--file',
             nova_descriptor_file
     ]) as app:
         app.run()
     self.manager_provider.mock_aws_manager.create_deployment.assert_called_once_with(
         'some-deploy-id', 'some-deployment-group', mock.ANY, 'my-bucket',
         'test-service/0.0.1.tar.gz')
Пример #6
0
 def test_stack_update(self):
     self.manager_provider.mock_aws_manager.get_stack.return_value = StackResult(
         "UPDATE_COMPLETE")
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(
         os.path.realpath(__file__))
     with get_test_app(argv=[
             'stack', 'update', 'test-environment', '--file',
             nova_descriptor_file
     ]) as app:
         app.run()
     self.manager_provider.mock_aws_manager.update_stack.assert_called_with(
         'test-service', mock.ANY, mock.ANY, mock.ANY)
Пример #7
0
 def test_no_deploy(self):
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(os.path.realpath(__file__))
     with get_test_app(argv=[
         'deploy',
         'test-environment',
         'test-stack',
         '--file',
         nova_descriptor_file,
         '--no-deployment'
     ]) as app:
         app.run()
     self.manager_provider.mock_aws_manager.create_deployment.assert_not_called()
Пример #8
0
 def test_exit_code_with_error(self):
     with self.assertRaises(SystemExit) as exit_code:
         with get_test_app(argv=['stack', 'update']) as app:
             code = 0
             try:
                 app.run()
             except NovaError as e:
                 self.assertEqual(e.message, INCORRECT_UPDATE_ARGS_USAGE)
                 code = handle_exception(e)
             finally:
                 app.close(code)
         self.assertEqual(exit_code.exception.code, 1)
Пример #9
0
 def test_stack_create(self):
     self.manager_provider.mock_aws_manager.get_stack.return_value = StackResult("CREATE_COMPLETE")
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(os.path.realpath(__file__))
     with get_test_app(argv=[
         'stack',
         'create',
         'test-environment',
         '--file',
         nova_descriptor_file
     ]) as app:
         app.run()
     self.manager_provider.mock_aws_manager.create_stack.assert_called_with(
         'test-service',
         mock.ANY
     )
Пример #10
0
 def test_deploy(self):
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(os.path.realpath(__file__))
     with get_test_app(argv=[
         'deploy',
         'test-environment',
         'test-stack',
         '--file',
         nova_descriptor_file
     ]) as app:
         app.run()
     self.manager_provider.mock_aws_manager.create_deployment.assert_called_once_with(
         'some-deploy-id',
         'some-deployment-group',
         mock.ANY,
         'my-bucket',
         'test-service/0.0.1.tar.gz'
     )
Пример #11
0
 def test_exit_code_without_error(self):
     self.manager_provider.mock_aws_manager.get_stack.return_value = StackResult("CREATE_COMPLETE")
     nova_descriptor_file = '%s/nova.yml' % os.path.dirname(os.path.realpath(__file__))
     with self.assertRaises(SystemExit) as exit_code:
         with get_test_app(argv=[
             'stack',
             'create',
             'test-environment',
             '--file',
             nova_descriptor_file
         ]) as app:
             code = 0
             try:
                 app.run()
                 self.manager_provider.mock_aws_manager.create_stack.assert_called_with(
                     'test-service',
                     mock.ANY
                 )
             except Exception as e:
                 code = handle_exception(e)
             finally:
                 app.close(code)
         self.assertEqual(exit_code.exception.code, 0)
Пример #12
0
 def test_stack_update_no_args(self):
     with get_test_app(argv=['stack', 'update']) as app:
         try:
             app.run()
         except NovaError as e:
             self.assertEqual(e.message, INCORRECT_UPDATE_ARGS_USAGE)
Пример #13
0
 def test_deploy_no_args(self):
     with get_test_app(argv=['deploy']) as app:
         try:
             app.run()
         except NovaError as e:
             self.assertEqual(e.message, INCORRECT_ARGS_USAGE)
Пример #14
0
 def test_stash_get(self):
     with get_test_app(argv=["stash", "get"]) as app:
         try:
             app.run()
         except NovaError as e:
             self.assertEqual(e.message, INCORRECT_GET_ARGS_USAGE)
Пример #15
0
 def test_stack_create(self):
     with get_test_app(argv=['stack', 'create']) as app:
         try:
             app.run()
         except NovaError as e:
             self.assertEqual(e.message, INCORRECT_CREATE_ARGS_USAGE)
Пример #16
0
 def test_stack_update_no_args(self):
     with get_test_app(argv=['stack', 'update']) as app:
         try:
             app.run()
         except NovaError as e:
             self.assertEqual(e.message, INCORRECT_UPDATE_ARGS_USAGE)