Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-12666590: Add regression tests in MUnit #674

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/test/munit/cookies/request-cookies-test-case.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<http:request-connection host="localhost" port="${dynamic.port}"/>
</http:request-config>

<http:request-config name="requestCookiesRequesterConfig7" enableCookies="true">
<http:request-connection host="localhost" port="${dynamic.port}"/>
</http:request-config>

<munit:test name="requestWithoutCookieTest" description="Send a request without a Cookie header">
<munit:enable-flow-sources>
<munit:enable-flow-source value="getMyCookieHeaderAsPayloadFlow" />
Expand Down Expand Up @@ -188,6 +192,25 @@
</munit:validation>
</munit:test>

<munit:test name="nullCookie" description="When cookie header is null, we don't raise a NPE">
<munit:enable-flow-sources>
<munit:enable-flow-source value="getMyCookieHeaderAsPayloadFlow" />
</munit:enable-flow-sources>

<munit:execution>
<http:request method="GET" config-ref="requestCookiesRequesterConfig7" path="/getMyCookieHeaderAsPayload">
<http:headers>
#[{'Cookie' : null}]
</http:headers>
</http:request>
<set-variable value="#[payload as String]" variableName="myCookieHeader"/>
</munit:execution>

<munit:validation>
<munit-tools:assert-equals actual="#[vars.myCookieHeader]" expected='#[""]'/>
</munit:validation>
</munit:test>

<flow name="getMyCookieHeaderAsPayloadFlow">
<http:listener config-ref="requestCookiesListenerConfig" path="/getMyCookieHeaderAsPayload" />
<set-payload value="#[attributes.headers.'Cookie']" />
Expand Down