-
Notifications
You must be signed in to change notification settings - Fork 99
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
Http Test can now post files. Usage: post file <fileName> to <url>. #49
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0bdef26
Http Test can now post files. Usage: post file <fileName> to <url>.
tcnh e504a75
AcceptanceTests extended with a binary file post. Also added same tes…
tcnh 4e731ca
small binary file to be uploaded with some readable meta-data
tcnh ffc50f3
Moved file path logic to fixture. Environment and HttpClient now take…
tcnh e37620f
Updated by PR suggestions
tcnh 17ed407
Example has better readability
tcnh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
15 changes: 15 additions & 0 deletions
15
wiki/FitNesseRoot/HsacAcceptanceTests/SlimTests/HttpTest/HttpFileUploadTest/content.txt
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,15 @@ | ||
|script |file fixture | | ||
|$createdFile=|create|upload.txt|containing|This is a file to test the file upload| | ||
|
||
|script |mock xml server setup| | ||
|add response|{{{<binary/>}}} | | ||
|$url= |get mock server url | | ||
|
||
|script |http test | | ||
|post file|$createdFile|to|$url| | ||
|
||
|table: Mock Server Message Report| | ||
|
||
|script|mock xml server setup| | ||
|stop | | ||
|
12 changes: 12 additions & 0 deletions
12
wiki/FitNesseRoot/HsacAcceptanceTests/SlimTests/HttpTest/HttpFileUploadTest/properties.xml
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<properties> | ||
<Edit>true</Edit> | ||
<Files>true</Files> | ||
<Properties>true</Properties> | ||
<RecentChanges>true</RecentChanges> | ||
<Refactor>true</Refactor> | ||
<Search>true</Search> | ||
<Test>true</Test> | ||
<Versions>true</Versions> | ||
<WhereUsed>true</WhereUsed> | ||
</properties> |
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 |
---|---|---|
|
@@ -25,30 +25,33 @@ Incomplete address: no zip code</PO:confirmation> | |
</detail></SOAP-ENV:Fault> | ||
</SOAP-ENV:Body></SOAP-ENV:Envelope>}}}|with status|500| | ||
|add response|<no xml | | ||
|add response|{{{<binary/>}}} | | ||
|$url= |get mock server url| | ||
|
||
|script|xml http test | | ||
|post |{{{<Hallo/>}}} |to |$url | | ||
|check |xPath |count(/dag) |1 | | ||
|reject|post |{{{<ClientFault/>}}} |to |$url | | ||
|show |response | | ||
|check |response status|500 | | ||
|check |raw xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info | | ||
|show |response headers | | ||
|check |response header|Content-length |556 | | ||
|note |next line is commented out so we won't have a real exception, uncomment to see that SOAP content is shown in exception | | ||
|note |check |xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info| | ||
|reject|post |{{{<ServerFault/>}}} |to |$url | | ||
|show |response | | ||
|check |response status|500 | | ||
|check |raw xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info | | ||
|note |next line is commented out so we won't have a real exception, uncomment to see that SOAP content is shown in exception | | ||
|note |check |xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info| | ||
|reject|post |{{{<NoXml/>}}} |to |$url | | ||
|check |response status|200 | | ||
|check |response |<no xml | | ||
|note |next line is commented out so we won't have a real exception, uncomment to see that non-XML content is shown in exception | | ||
|note |check |xPath |count(/*) |0 | | ||
|script |xml http test | | ||
|post |{{{<Hallo/>}}} |to |$url | | ||
|check |xPath |count(/dag) |1 | | ||
|reject |post |{{{<ClientFault/>}}} |to |$url | | ||
|show |response | | ||
|check |response status|500 | | ||
|check |raw xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info | | ||
|show |response headers | | ||
|check |response header|Content-length |556 | | ||
|note |next line is commented out so we won't have a real exception, uncomment to see that SOAP content is shown in exception | | ||
|note |check |xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info| | ||
|reject |post |{{{<ServerFault/>}}} |to |$url | | ||
|show |response | | ||
|check |response status|500 | | ||
|check |raw xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info | | ||
|note |next line is commented out so we won't have a real exception, uncomment to see that SOAP content is shown in exception | | ||
|note |check |xPath |/env:Envelope/env:Body/env:Fault/faultstring|Message does not have necessary info| | ||
|reject |post |{{{<NoXml/>}}} |to |$url | | ||
|check |response status|200 | | ||
|check |response |<no xml | | ||
|note |next line is commented out so we won't have a real exception, uncomment to see that non-XML content is shown in exception | | ||
|note |check |xPath |count(/*) |0 | | ||
|
||
|table: Mock Server Message Report| | ||
|
||
|script|mock xml server setup| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why a second 'stop mock server table' |
||
|stop | | ||
|stop | |
32 changes: 32 additions & 0 deletions
32
wiki/FitNesseRoot/HsacExamples/SlimTests/HttpTests/HttpPostFileTest/content.txt
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,32 @@ | ||
!contents -R2 -g -p -f -h | ||
!*> We start a mock server to receive the binary file and display the request later (specify one response per request) | ||
|
||
|script |mock xml server setup | | ||
|add response|{{{<status>OK</status>}}}| | ||
|add response|{{{<status>OK</status>}}}| | ||
|add response|{{{<status>OK</status>}}}| | ||
|add response|{{{<status>OK</status>}}}| | ||
|$mockUrl= |get mock server url | | ||
|
||
*! | ||
Now we post files to the service. Note the different notation options. We can: | ||
|
||
* Use wiki-urls pointing to files in the files folder or below | ||
* Use relative paths (non links) from files folder (include files folder) | ||
|
||
|script |http test | | ||
|post file|http://files/subfolder/testFile.txt|to|$mockUrl| | ||
|post file|files/subfolder/testFile.txt |to|$mockUrl| | ||
|post file|http://files/test.png |to|$mockUrl| | ||
|post file|files/test.png |to|$mockUrl| | ||
|
||
The Message report will show the received request: | ||
|
||
|table: Mock Server Message Report| | ||
|
||
!*> Stop the mock server | ||
|
||
|script|mock xml server setup| | ||
|stop | | ||
|
||
*! |
12 changes: 12 additions & 0 deletions
12
wiki/FitNesseRoot/HsacExamples/SlimTests/HttpTests/HttpPostFileTest/properties.xml
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<properties> | ||
<Edit/> | ||
<Files/> | ||
<Properties/> | ||
<RecentChanges/> | ||
<Refactor/> | ||
<Search/> | ||
<Test/> | ||
<Versions/> | ||
<WhereUsed/> | ||
</properties> |
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
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 @@ | ||
This file is used to test the posting of a binary data file to a webservice using HttpTest |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should be consistent with the way paths to upload files are handled by BrowserTest:
if the file is located in the files directory its path must beging with 'files/', otherwise we expect a full path.
That means we always use this method, and not start by looking in the files section. I.e. remove the 4 lines above.