package com.ycwl.basic.image.enhancer.adapter;

import com.ycwl.basic.image.enhancer.entity.BceEnhancerConfig;
import org.junit.Test;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

import static org.junit.jupiter.api.Assertions.*;

public class BceImageEnhancerTest {
    private BceImageEnhancer getEnhancer() {
        BceImageEnhancer enhancer = new BceImageEnhancer();
        BceEnhancerConfig config = new BceEnhancerConfig();
        config.setQps(1);
        config.setAppId("119554288");
        config.setApiKey("OX6QoijgKio3eVtA0PiUVf7f");
        config.setSecretKey("dYatXReVriPeiktTjUblhfubpcmYfuMk");
        enhancer.setConfig(config);
        return enhancer;
    }

    @Test
    public void enhance() throws IOException {
        BceImageEnhancer enhancer = getEnhancer();
        MultipartFile file = enhancer.enhance("8b84a9f5-44fc-4f7e-8550-710727c47070.jpg");
        file.transferTo(new File("out.jpg"));
    }
}