Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webmagic
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
webmagic
Commits
7476cecc
Commit
7476cecc
authored
Dec 18, 2016
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more stable test
parent
5ce3fdfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
12 deletions
+3
-12
HttpClientDownloaderTest.java
...decraft/webmagic/downloader/HttpClientDownloaderTest.java
+3
-12
No files found.
webmagic-core/src/test/java/us/codecraft/webmagic/downloader/HttpClientDownloaderTest.java
View file @
7476cecc
package
us
.
codecraft
.
webmagic
.
downloader
;
import
com.github.dreamhead.moco.
*
;
import
com.github.dreamhead.moco.
HttpServer
;
import
com.github.dreamhead.moco.Runnable
;
import
com.github.dreamhead.moco.Runner
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
us.codecraft.webmagic.Page
;
import
us.codecraft.webmagic.Request
;
...
...
@@ -28,19 +28,10 @@ public class HttpClientDownloaderTest {
public
static
final
String
PAGE_ALWAYS_NOT_EXISTS
=
"http://localhost:13421/404"
;
@Ignore
@Test
public
void
testCookie
()
{
Site
site
=
Site
.
me
().
setDomain
(
"www.diandian.com"
).
addCookie
(
"t"
,
"43ztv9srfszl99yxv2aumx3zr7el7ybb"
);
HttpClientDownloader
httpClientDownloader
=
new
HttpClientDownloader
();
Page
download
=
httpClientDownloader
.
download
(
new
Request
(
"http://www.diandian.com"
),
site
.
toTask
());
assertTrue
(
download
.
getHtml
().
toString
().
contains
(
"flashsword30"
));
}
@Test
public
void
testDownloader
()
{
HttpClientDownloader
httpClientDownloader
=
new
HttpClientDownloader
();
Html
html
=
httpClientDownloader
.
download
(
"https://
github.com
"
);
Html
html
=
httpClientDownloader
.
download
(
"https://
www.baidu.com/
"
);
assertTrue
(!
html
.
getFirstSourceText
().
isEmpty
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment