MCPcopy Index your code
hub / github.com/httpie/cli / test_session_read_only

Method test_session_read_only

tests/test_sessions.py:124–149  ·  view source on GitHub ↗
(self, httpbin)

Source from the content-addressed store, hash-verified

122 != r4.json['headers']['Authorization'])
123
124 def test_session_read_only(self, httpbin):
125 self.start_session(httpbin)
126 # Get a response from the original session.
127 r2 = http('--session=test', 'GET', httpbin + '/get',
128 env=self.env())
129 assert HTTP_OK in r2
130
131 # Make a request modifying the session data but
132 # with --session-read-only.
133 r3 = http('--follow', '--session-read-only=test',
134 '--auth=username:password2', 'GET',
135 httpbin + '/cookies/set?hello=world2', 'Hello:World2',
136 env=self.env())
137 assert HTTP_OK in r3
138
139 # Get a response from the updated session.
140 r4 = http('--session=test', 'GET', httpbin + '/get',
141 env=self.env())
142 assert HTTP_OK in r4
143
144 # Origin can differ on Travis.
145 del r2.json['origin'], r4.json['origin']
146 # Different for each request.
147
148 # Should be the same as before r3.
149 assert r2.json == r4.json
150
151 def test_session_overwrite_header(self, httpbin):
152 self.start_session(httpbin)

Callers

nothing calls this directly

Calls 3

start_sessionMethod · 0.95
httpFunction · 0.85
envMethod · 0.80

Tested by

no test coverage detected