package com.poyee.goods;

import com.poyee.BaseTest;
import com.tzy.PoyiApplication;
import com.tzy.common.constant.Constants;
import com.tzy.common.utils.http.forest.CommonForestClient;
import com.tzy.dto.local.CardGroupGoodsDTO;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.teasoft.bee.osql.SuidRich;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author by po'yi
 * @Classname AppActControllerTest
 * @Description TODO
 * @Date 2022/11/14 18:47
 */
@Slf4j
@SpringBootTest(classes = PoyiApplication.class)
@RunWith(SpringRunner.class)
class GoodsLocalTest extends BaseTest {
	@Autowired
	private SuidRich suidRich;
	@Resource
	private CommonForestClient commonForestClient;

	@Test
	void addGoods() throws Exception {
		CardGroupGoodsDTO condition=new CardGroupGoodsDTO();
		condition.setGroupInfoId(944L);
		//condition.setGroupInfoId(1120L);
		//condition.setGroupInfoId(1115L);
		//condition.setGroupInfoId(1089L);
		List<CardGroupGoodsDTO> goods = suidRich.select(condition);
		String url = "http://localhost:8089/api/goods/add";
		String result = commonForestClient.sendPost(url, Constants.JSON_HEADS, goods);
		System.out.println(result);
	}

}