package me.chyxion.tigon.shiro;

import me.chyxion.tigon.shiro.test.Main;
import me.chyxion.tigon.webmvc.test.ControllerTestTool;
import org.apache.shiro.web.filter.authc.UserFilter;
import org.junit.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.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

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

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Jan 27, 2015 3:27:08 PM
 */
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = Main.class)
@SpringBootTest
public class SiteControllerTest {

	@Autowired
	private ControllerTestTool t;
	@Autowired
	private UserFilter userFilter;

	@Test
	public void testIndex() {
		t.print(t.get("/"));
	}

	@Test
	public void testRaw() {
		t.print(t.get("/raw"));
	}

	@Test
	public void testInt() {
		t.print(t.get("/int"));
	}

	@Test
	public void testPost() {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", "id");
		params.put("name", "Shaun Chyxion");
		params.put("gender", "");
		t.print(t.post("/post", params));
	}
}
