-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ZnServerTest>>#testLogging with ZnLogEvent rendering
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
repository/Zinc-Tests.package/ZnServerTest.class/instance/testLogging.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
tests | ||
testLogging | ||
| client logEventCollection count renderedLogEvents | | ||
logEventCollection := OrderedCollection new. | ||
ZnLogEvent announcer | ||
when: ZnLogEvent do: [ :event | logEventCollection add: event ]. | ||
self withServerDo: [ :server | | ||
server serverId: #S1; logLevel: 3. | ||
client := ZnClient new. | ||
client clientId: #C1; logLevel: 3. | ||
client get: (server localUrl addPathSegment: #small). | ||
self assert: client isSuccess. | ||
client get: (server localUrl addPathSegment: #error). | ||
self deny: client isSuccess. | ||
server delegate map: #redirect to: [ :request | ZnResponse redirect: #welcome ]. | ||
client get: (server localUrl addPathSegment: #redirect). | ||
self assert: client isSuccess. | ||
client close ]. | ||
count := ZnLogEvent announcer numberOfSubscriptions. | ||
ZnLogEvent announcer | ||
unsubscribe: self. | ||
self assert: ZnLogEvent announcer numberOfSubscriptions equals: count -1. | ||
self deny: logEventCollection isEmpty. | ||
renderedLogEvents := String streamContents: [ :out | | ||
logEventCollection do: [ :event | out print: event; cr ] ]. | ||
self deny: renderedLogEvents isEmpty |