/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 * <p>
 * https://www.renren.io
 * <p>
 * 版权所有，侵权必究！
 */

package test.com.pjilisense.flxai.controller;

import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import test.com.pjilisense.flxai.TestUtils;

import java.util.HashMap;
import java.util.Map;

public class AppAiPluginControllerTest {
    @BeforeEach
    public void setUpTestDataWithinTransaction() {
        // set up test data within the transaction
    }
    @AfterEach
    public void tearDownWithinTransaction() {
        // execute "tear down" logic within the transaction
    }

    @Test
    public void testAppAiAssistantSave() {
        String url = TestUtils.WebconnectURL+"/api/robot/appaiplugin";
        String charset = TestUtils.UTF8;
        try {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("author","YoungTx2");
            params.put("homepage","https://github.com/YoungTx/alps-tongyi-image2");
            params.put("identifier","alps-tongyi-image2");
            params.put("locale","en-US");
            params.put("manifest","https://alps-tongyi-image.vercel.app/manifest.json");
            params.put("avatar","avatar2");
            params.put("tags","图像,通义,万象");
            params.put("title","通义万象图像生成器");
            params.put("description","此插件使用阿里巴巴的通义万象模型根据文本提示生成图像。");
            params.put("category","media-generate");
            params.put("schemaVersion","1");
            params.put("createdAt","2024-08-09");
            params.put("userid","flx");
            String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
            System.out.println(body);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Test
    public void testGetAllAiAssistant() {
        String url = TestUtils.WebconnectURL+"/api/robot/appaiplugin/getAllAiPlugin?userid=flx";
        String charset = TestUtils.UTF8;
        try {
            String body = TestUtils.doGet(url, charset);
            System.out.println(body);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}