/** * Verifies that submitting the login form without entering a name results in a page containing * the text "Login failed" */ public void testQuery() throws Exception { WebConversation conversation = new WebConversation(); // GetMethodWebRequest WebRequest request = new GetMethodWebRequest(TestConstants.host + "rest/fPMovieTemplate/query.json"); request.setParameter("JSESSIONID", user.getLoginSessionid()); WebResponse response = tryGetResponse(conversation, request); // WebForm loginForm = response.getForms()[0]; // request = loginForm.getRequest(); // response = conversation.getResponse( request ); HttpUtils.println(conversation, request, response); assertTrue("登录-成功", response.getText().indexOf("success") != -1); // // assertTrue( "Login not rejected", response.getText().indexOf( "Login failed" ) != -1 ); }
/** * Verifies that submitting the login form without entering a name results in a page containing * the text "Login failed" */ public void testSaveSuccess() throws Exception { WebConversation conversation = new WebConversation(); // GetMethodWebRequest FPFamilyPhotoCollectionJsonform s = new FPFamilyPhotoCollectionJsonform(); s.setTitle("7996家庭相册"); String json = JSONUtils.getJsonString(s); HttpUtils.printjson(json); ByteArrayInputStream input = new ByteArrayInputStream(json.getBytes(SystemConstants.Charset)); PostMethodWebRequest request = new PostMethodWebRequest( TestConstants.host + "rest/fpFamilyPhotoCollection/save.json" + user.addParameter_JSESSIONID(), input, TestConstants.contentType); WebResponse response = tryGetResponse(conversation, request); HttpUtils.println(conversation, request, response); assertTrue("增加-成功", response.getText().indexOf("success") != -1); }