AdminOpLogTest.java 1.18 KB
package com.xkl.internal;

import com.utils.DESTools;
import com.xkl.Constants;
import com.xkl.EncodeTools;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import com.xkl.partner.TokenTest;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;

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

/**
 * Created by zhaoyue on 2017/3/11.
 */
public class AdminOpLogTest {
    private static final String URL_ADMIN_OP_LOG = Constants.URL_PREFIX + "/adminOpLog";

    @Test
    public void testAdminOpLog() {
        String token = TokenTest.adminLoginAndGetToken(Constants.ADMIN_ACCOUNT, Constants.ADMIN_PWD);

        Map<String, String> params = new HashMap<String, String>();
        params.put("username", Constants.USR_ACC);
        params.put("operation", Integer.toString(Constants.OP_NEWUSER_DIAGNOSE));
        params.put("t", HttpTools.getNow());
        params.put("type", Constants.KEY_ID);
        params.put("sign", HttpTools.getSign(params));
        String response = HttpTools.requestByMapWithToken(URL_ADMIN_OP_LOG, "POST", params, token);
        System.out.println(response);
        Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
    }
}