package com;

import com.sv.entity.Member;
import com.sv.service.api.MemberService;
import com.sv.service.common.FaceService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.NONE)
public class FaceServiceTest {

    @Resource
    private FaceService faceService;

    @Resource
    private MemberService memberService;


    @Test
    public void test(){
        try {
            faceService.login();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void addFace() {
        try {
            faceService.login();
            faceService.show("7","","");
            faceService.show2();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void addMember() throws IOException {
        faceService.login();
        Member member = memberService.findById(15);
        Integer subjectId = faceService.addSubject(3,member);
        memberService.setMemberFaceInfo(subjectId,"xxx",member.getId(),1);
    }

}
