MCPcopy
hub / github.com/httpie/cli / test_session_update

Method test_session_update

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

Source from the content-addressed store, hash-verified

99 assert 'Basic ' in r2.json['headers']['Authorization']
100
101 def test_session_update(self, httpbin):
102 self.start_session(httpbin)
103 # Get a response to a request from the original session.
104 r2 = http('--session=test', 'GET', httpbin + '/get',
105 env=self.env())
106 assert HTTP_OK in r2
107
108 # Make a request modifying the session data.
109 r3 = http('--follow', '--session=test', '--auth=username:password2',
110 'GET', httpbin + '/cookies/set?hello=world2',
111 'Hello:World2',
112 env=self.env())
113 assert HTTP_OK in r3
114
115 # Get a response to a request from the updated session.
116 r4 = http('--session=test', 'GET', httpbin + '/get',
117 env=self.env())
118 assert HTTP_OK in r4
119 assert r4.json['headers']['Hello'] == 'World2'
120 assert r4.json['headers']['Cookie'] == 'hello=world2'
121 assert (r2.json['headers']['Authorization']
122 != r4.json['headers']['Authorization'])
123
124 def test_session_read_only(self, httpbin):
125 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