The Trunk: WebClient-Tests-pre.57.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: WebClient-Tests-pre.57.mcz

commits-2
Patrick Rein uploaded a new version of WebClient-Tests to project The Trunk:
http://source.squeak.org/trunk/WebClient-Tests-pre.57.mcz

==================== Summary ====================

Name: WebClient-Tests-pre.57
Author: pre
Time: 30 April 2019, 7:02:07.214906 pm
UUID: 74aaf80c-2790-c749-90c9-7ba162e1e812
Ancestors: WebClient-Tests-pre.56

Recategorizes some methods in WebClient-Tests

=============== Diff against WebClient-Tests-pre.56 ===============

Item was changed:
+ ----- Method: WebClientServerTest>>expectedFailures (in category 'failures') -----
- ----- Method: WebClientServerTest>>expectedFailures (in category 'setup') -----
  expectedFailures
  "Some old versions of HTTPSocket are broken"
 
  ((HTTPSocket respondsTo: #httpRequestHandler:)
  or:[SystemVersion current version beginsWith: 'Pharo']) ifFalse:[^#(testMultipartFiles2)].
 
  ^#()!

Item was changed:
+ ----- Method: WebClientServerTest>>localHostUrl (in category 'private') -----
- ----- Method: WebClientServerTest>>localHostUrl (in category 'setup') -----
  localHostUrl
  ^'<a href="http://localhost:'">http://localhost:', self port asString!

Item was changed:
+ ----- Method: WebClientServerTest>>port (in category 'private') -----
- ----- Method: WebClientServerTest>>port (in category 'setup') -----
  port
  "Use a random port to minimise chances of concurrently running test suites clashing."
  ^ port
  ifNil: [port := (10000 to: 50000) atRandom]!

Item was changed:
+ ----- Method: WebClientServerTest>>setUp (in category 'running') -----
- ----- Method: WebClientServerTest>>setUp (in category 'setup') -----
  setUp
  server := WebServer new listenOn: self port.
  server passwordAt: 'user' realm: 'test' put: 'pass'.
  server addToken: 'shushitsissupersecret' toRealm: 'test'.!

Item was changed:
+ ----- Method: WebClientServerTest>>tearDown (in category 'running') -----
- ----- Method: WebClientServerTest>>tearDown (in category 'setup') -----
  tearDown
  server ifNotNil:[server destroy].
  !

Item was added:
+ ----- Method: WebClientServerTest>>testMultipleRequestsInOneInstance (in category 'tests - requests') -----
+ testMultipleRequestsInOneInstance
+
+ | resp semaphore client |
+ semaphore := Semaphore new.
+ server addService: '/endpoint' action:[:req |
+ req send200Response: 'ok'.
+ semaphore signal].
+
+ client := WebClient new.
+ 1 to: 10 do: [:i |
+ resp := client httpGet: self localHostUrl, '/endpoint' do: [ :request |
+ request
+ headerAt: 'Connection' put: 'Keep-Alive';
+ headerAt: 'Accept' put: '*/*' ].
+ semaphore wait.
+ self assert: resp code = 200.]!