def test_publish_helper(): """CLI - Publish Athena Function""" config = MockCLIConfig(config=basic_streamalert_config()) package = AthenaPackage(version='1.0', config=config) publish = LambdaVersion(config=config, clustered_deploy=False, package=package) result = publish._publish_helper() assert_equal( config['lambda']['athena_partition_refresh_config']['current_version'], 11) assert_true(result)
def test_version_helper(): """CLI - Publish Helper""" package = AthenaPackage(version='1.0', config=basic_streamalert_config()) publish = LambdaVersion(config=basic_streamalert_config(), clustered_deploy=False, package=package) current_version = 10 fake_client = MockLambdaClient('athena', current_version=current_version) result = publish._version_helper(client=fake_client, function_name='test', code_sha_256='12345', date='2017-01-01') assert_equal(result, current_version + 1)
def test_version_helper_error(mock_logging): """CLI - Publish Helper Raises Error""" package = AthenaPackage(version='1.0', config=basic_streamalert_config()) publish = LambdaVersion(config=basic_streamalert_config(), clustered_deploy=False, package=package) current_version = 10 fake_client = MockLambdaClient('athena', current_version=current_version, throw_exception=True) result = publish._version_helper(client=fake_client, function_name='test', code_sha_256='12345', date='2017-01-01') assert_false(result) assert_true(mock_logging.error.called)
def _deploy_athena_partition_refresh(): """Create Athena Partition Refresh package and publish""" athena_package = AthenaPackage(config=CONFIG, version=current_version) athena_package.create_and_upload() return athena_package