Implementing testDownloadImagesInto

This commit is contained in:
EduardoRiesco 2017-12-02 18:59:58 +00:00 committed by SantiagoBragagnolo
parent 8796e71adc
commit 7eee23f5f1
1 changed files with 20 additions and 4 deletions

View File

@ -33,19 +33,35 @@ GrafoscopioNodeTest >> testDemoteNode [
]
{ #category : #tests }
GrafoscopioNodeTest >> testDownloadImagesInto [
"comment stating purpose of message"
|txt txtNode|
txt:= '<html> <body> <img src="web/files/pharo-logo-small.png">
<img src="https://pharo.org/web/files/pharo.png">
</body></html>'.
txtNode := GrafoscopioNode new body: txt.
txtNode links: 'http://pharo.org'.
txtNode downloadImagesInto: FileLocator temp.
self assert: (FileLocator temp / 'web') allChildren size equals: 4.
]
{ #category : #tests }
GrafoscopioNodeTest >> testExtractHtmlImages [
"comment stating purpose of message"
|txt txtNode|
txt:= '<html> <body> <img src="http://pharo.org/files/pharo.png">
<img src="http://pharo.org/files/pharo.png">
<img src="http://pharo.org/files/pharo2.png">
txt:= '<html> <body> <img src="/web/files/pharo-logo-small.png">
<img src="https://pharo.org/web/files/pharo.png">
</body></html>'.
txtNode := GrafoscopioNode new body: txt.
txtNode links: 'http://pharo.org/files/'.
self assert: (txtNode extractHtmlImages) size equals: 2.
txtNode extractHtmlImages.
txtNode downloadImagesInto: FileLocator temp.
self assert: (FileLocator temp / 'web' ) allChildren size equals: 4.
]