"mysql:/pro.shanhy.com:3306/ApolloPortalDB" did not exist on "84537673baba3128f9773f15cb01cf11af54369d"
Commit c665ffbd authored by Liang Ding's avatar Liang Ding

测试用例改进

parent b166a363
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
package org.b3log.solo.processor; package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Latkes;
import org.b3log.solo.AbstractTestCase; import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.MockRequest; import org.b3log.solo.MockRequest;
import org.b3log.solo.MockResponse; import org.b3log.solo.MockResponse;
...@@ -22,7 +23,7 @@ import org.testng.annotations.Test; ...@@ -22,7 +23,7 @@ import org.testng.annotations.Test;
* {@link BlogProcessor} test case. * {@link BlogProcessor} test case.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.2, Oct 28, 2018 * @version 1.0.0.3, May 9, 2020
* @since 1.7.0 * @since 1.7.0
*/ */
@Test(suiteName = "processor") @Test(suiteName = "processor")
...@@ -38,7 +39,7 @@ public class BlogProcessorTestCase extends AbstractTestCase { ...@@ -38,7 +39,7 @@ public class BlogProcessorTestCase extends AbstractTestCase {
mockDispatcher(request, response); mockDispatcher(request, response);
final String content = response.getString(); final String content = response.getString();
Assert.assertTrue(StringUtils.startsWith(content, "{\"staticServePath\":\"http://localhost:8080\"")); Assert.assertTrue(StringUtils.startsWith(content, "{\"staticServePath\":\"" + Latkes.getServePath() + "\""));
} }
/** /**
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
*/ */
package org.b3log.solo.service; package org.b3log.solo.service;
import org.b3log.latke.Latkes;
import org.b3log.latke.model.User; import org.b3log.latke.model.User;
import org.b3log.latke.util.URLs;
import org.b3log.solo.AbstractTestCase; import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.util.Solos; import org.b3log.solo.util.Solos;
import org.json.JSONArray; import org.json.JSONArray;
...@@ -24,7 +26,7 @@ import org.testng.annotations.Test; ...@@ -24,7 +26,7 @@ import org.testng.annotations.Test;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/nanolikeyou">nanolikeyou</a> * @author <a href="https://hacpai.com/member/nanolikeyou">nanolikeyou</a>
* @version 1.0.0.3, Feb 11, 2019 * @version 1.0.0.4, May 9, 2020
*/ */
@Test(suiteName = "service") @Test(suiteName = "service")
public class UserQueryServiceTestCase extends AbstractTestCase { public class UserQueryServiceTestCase extends AbstractTestCase {
...@@ -89,9 +91,10 @@ public class UserQueryServiceTestCase extends AbstractTestCase { ...@@ -89,9 +91,10 @@ public class UserQueryServiceTestCase extends AbstractTestCase {
*/ */
public void getLoginURL() { public void getLoginURL() {
final UserQueryService userQueryService = getUserQueryService(); final UserQueryService userQueryService = getUserQueryService();
final String loginURL = userQueryService.getLoginURL("redirectURL"); final String redirectURI = "/redirectURI";
final String loginURL = userQueryService.getLoginURL(redirectURI);
Assert.assertEquals(loginURL, "/start?referer=http%3A%2F%2Flocalhost%3A8080redirectURL"); Assert.assertEquals(loginURL, "/start?referer=" + URLs.encode(Latkes.getServePath() + redirectURI));
} }
/** /**
...@@ -101,6 +104,6 @@ public class UserQueryServiceTestCase extends AbstractTestCase { ...@@ -101,6 +104,6 @@ public class UserQueryServiceTestCase extends AbstractTestCase {
final UserQueryService userQueryService = getUserQueryService(); final UserQueryService userQueryService = getUserQueryService();
final String logoutURL = userQueryService.getLogoutURL(); final String logoutURL = userQueryService.getLogoutURL();
Assert.assertEquals(logoutURL, "/logout?referer=http%3A%2F%2Flocalhost%3A8080"); Assert.assertEquals(logoutURL, "/logout?referer=" + URLs.encode(Latkes.getServePath()));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment