package com.siyuangroup.test;


import org.json.JSONException;
import org.json.JSONObject;

import com.api.UserAPI;
import com.google.gson.JsonObject;
import com.utils.L;

public class UserAPITest extends BaseTestActivity {
	private String username = "test11";
	private String password = "12345678";
	private String profile_name = "jayin";
	private String profile_nickname = "ton";
	private String profile_email = "g@py.cn";

	@Override
	public void test1Click() {
		register();
	}

	private void register() {
		UserAPI api = new UserAPI();
		api.regist(username, password, profile_nickname, profile_email,
				new Response());
	}

	@Override
	public void test2Click() {
		login();
	}

	private void login() {
		UserAPI api = new UserAPI();
		api.login(username, "123456", new Response());

	}

	@Override
	public void test3Click() {
		resetpsw("12345678", "123456");
		
	}
	
	private void resetpsw(String oldpsw, String newpsw) {
		UserAPI api = new UserAPI();
		api.resetPassword(oldpsw, newpsw, new Response());
	}
	@Override
	public void test4Click() {
		 //login out
		UserAPI api = new UserAPI();
		api.logout(new Response());
	}
	

	@Override
	public void onInit() {
		
		String json = "{\"test\":NULL}";
		JSONObject obj;
		try {
			obj = new JSONObject(json);
			 L.i("json -->"+obj.toString());
			 L.i("jsonOjb -->"+json);
			  L.i("isNull() -->"+obj.isNull("go"));
			  L.i("get()--->"+obj.get("go"));
		} catch (JSONException e) {
			e.printStackTrace();
		}
      
	}

	@Override
	public String setTitle() {
		return "UserApiTest";
	}

	

}

@@ -1231,315 +1231,9 @@
 %7B%0D%0A%09
-%09%0D%0A%09%09String json = %22%7B%5C%22test%5C%22:NULL%7D%22;%0D%0A%09%09JSONObject obj;%0D%0A%09%09try %7B%0D%0A%09%09%09obj = new JSONObject(json);%0D%0A%09%09%09 L.i(%22json --%3E%22+obj.toString());%0D%0A%09%09%09 L.i(%22jsonOjb --%3E%22+json);%0D%0A%09%09%09  L.i(%22isNull() --%3E%22+obj.isNull(%22go%22));%0D%0A%09%09%09  L.i(%22get()---%3E%22+obj.get(%22go%22));%0D%0A%09%09%7D catch (JSONException e) %7B%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09%7D
+ 
 %0D%0A  

test login/resetpsw bug [bug fixed]