Implementing testDownloadImagesInto
This commit is contained in:
parent
8796e71adc
commit
7eee23f5f1
|
@ -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.
|
||||
|
||||
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue