mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
tests: add tests for netrc login/password combinations
Covers the following PRs: - #9066 - #9247 - #9248 Closes #9256
This commit is contained in:
parent
c40ec3178f
commit
56f1bbdd0c
@ -95,7 +95,7 @@ test643 test645 test646 test647 test648 test649 test650 test651 \
|
||||
test652 test653 test654 test655 test656 test658 test659 test660 test661 \
|
||||
test662 test663 test664 test665 test666 test667 test668 test669 \
|
||||
test670 test671 test672 test673 test674 test675 test676 test677 test678 \
|
||||
test679 test680 test681 \
|
||||
test679 test680 test681 test682 test683 test684 test685 \
|
||||
\
|
||||
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
|
||||
test709 test710 test711 test712 test713 test714 test715 test716 test717 \
|
||||
|
53
tests/data/test682
Normal file
53
tests/data/test682
Normal file
@ -0,0 +1,53 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
netrc
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Fri, 05 Aug 2022 10:09:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Type: text/plain
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
netrc with multiple logins - pick first
|
||||
</name>
|
||||
<command>
|
||||
--netrc-optional --netrc-file log/netrc%TESTNUMBER http://user1@%HOSTIP:%HTTPPORT/
|
||||
</command>
|
||||
<file name="log/netrc%TESTNUMBER" >
|
||||
machine %HOSTIP login user1 password passwd1
|
||||
machine %HOSTIP login user2 password passwd2
|
||||
</file>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
GET / HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Authorization: Basic %b64[user1:passwd1]b64%
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
53
tests/data/test683
Normal file
53
tests/data/test683
Normal file
@ -0,0 +1,53 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
netrc
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Fri, 05 Aug 2022 10:09:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Type: text/plain
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
netrc with multiple logins - pick second
|
||||
</name>
|
||||
<command>
|
||||
--netrc-optional --netrc-file log/netrc%TESTNUMBER http://user2@%HOSTIP:%HTTPPORT/
|
||||
</command>
|
||||
<file name="log/netrc%TESTNUMBER" >
|
||||
machine %HOSTIP login user1 password passwd1
|
||||
machine %HOSTIP login user2 password passwd2
|
||||
</file>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
GET / HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Authorization: Basic %b64[user2:passwd2]b64%
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
52
tests/data/test684
Normal file
52
tests/data/test684
Normal file
@ -0,0 +1,52 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
netrc
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Fri, 05 Aug 2022 10:09:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Type: text/plain
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
netrc with no login
|
||||
</name>
|
||||
<command>
|
||||
--netrc-optional --netrc-file log/netrc%TESTNUMBER http://%HOSTIP:%HTTPPORT/
|
||||
</command>
|
||||
<file name="log/netrc%TESTNUMBER" >
|
||||
machine %HOSTIP password 5up3r53cr37
|
||||
</file>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
GET / HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Authorization: Basic %b64[:5up3r53cr37]b64%
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
52
tests/data/test685
Normal file
52
tests/data/test685
Normal file
@ -0,0 +1,52 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
netrc
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Fri, 05 Aug 2022 10:09:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Type: text/plain
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
netrc with no login - provided user
|
||||
</name>
|
||||
<command>
|
||||
--netrc-optional --netrc-file log/netrc%TESTNUMBER http://user@%HOSTIP:%HTTPPORT/
|
||||
</command>
|
||||
<file name="log/netrc%TESTNUMBER" >
|
||||
machine %HOSTIP password 5up3r53cr37
|
||||
</file>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
</protocol>
|
||||
GET / HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Authorization: Basic %b64[user:5up3r53cr37]b64%
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</verify>
|
||||
</testcase>
|
Loading…
Reference in New Issue
Block a user