@@ -34,7 +34,7 @@ def test_post_success(mock_get_http_session):
34
34
session .post .return_value = _fake_response (201 , {"id" : 99 })
35
35
mock_get_http_session .return_value = session
36
36
37
- assert cc .post ("/labels/" , {"name" : "foo" }) == {"id" : 99 }
37
+ assert cc .post (session , "/labels/" , {"name" : "foo" }) == {"id" : 99 }
38
38
session .post .assert_called_once ()
39
39
40
40
@@ -47,7 +47,7 @@ def test_post_duplicate_name(mock_get_http_session):
47
47
)
48
48
mock_get_http_session .return_value = session
49
49
50
- out = cc .post ("/labels/" , {"name" : "foo" })
50
+ out = cc .post (session , "/labels/" , {"name" : "foo" })
51
51
assert out == {"id" : 42 , "name" : "foo" }
52
52
53
53
session .get .assert_called_once ()
@@ -61,7 +61,7 @@ def test_post_non_400_error_is_propagated(mock_get_http_session):
61
61
mock_get_http_session .return_value = session
62
62
63
63
with pytest .raises (requests .HTTPError ):
64
- cc .post ("/labels/" , {"name" : "foo" })
64
+ cc .post (session , "/labels/" , {"name" : "foo" })
65
65
66
66
# Ensure we don't try to deduplicate
67
67
session .get .assert_not_called ()
@@ -76,7 +76,7 @@ def test_post_400_dedupe_no_results_raises(mock_get_http_session):
76
76
mock_get_http_session .return_value = session
77
77
78
78
with pytest .raises (requests .HTTPError ) as exc :
79
- cc .post ("/labels/" , {"name" : "foo" , "organization" : 1 })
79
+ cc .post (session , "/labels/" , {"name" : "foo" , "organization" : 1 })
80
80
81
81
assert isinstance (exc .value , requests .HTTPError )
82
82
assert exc .value .response .status_code == 400
@@ -95,7 +95,7 @@ def test_post_400_dedupe_lookup_http_error_still_raises(mock_get_http_session):
95
95
mock_get_http_session .return_value = session
96
96
97
97
with pytest .raises (requests .HTTPError ):
98
- cc .post ("/labels/" , {"name" : "foo" })
98
+ cc .post (session , "/labels/" , {"name" : "foo" })
99
99
100
100
session .get .assert_called_once ()
101
101
@@ -108,7 +108,7 @@ def test_post_400_dedupe_params_subset_when_missing_org(mock_get_http_session):
108
108
mock_get_http_session .return_value = session
109
109
110
110
with pytest .raises (requests .HTTPError ):
111
- cc .post ("/labels/" , {"name" : "foo" })
111
+ cc .post (session , "/labels/" , {"name" : "foo" })
112
112
113
113
# Only 'name' present in params, no 'organization' since it wasn’t provided
114
114
_ , kwargs = session .get .call_args
@@ -124,6 +124,7 @@ def test_post_400_with_custom_dedupe_keys(mock_get_http_session):
124
124
125
125
with pytest .raises (requests .HTTPError ):
126
126
cc .post (
127
+ session ,
127
128
"/labels/" ,
128
129
{"name" : "foo" , "organization" : 1 , "extra" : "x" },
129
130
dedupe_keys = ("name" , "extra" ),
@@ -148,7 +149,7 @@ def test_post_400_error_json_fallback_to_text(mock_get_http_session):
148
149
mock_get_http_session .return_value = session
149
150
150
151
with pytest .raises (requests .HTTPError ) as exc :
151
- cc .post ("/labels/" , {"name" : "foo" })
152
+ cc .post (session , "/labels/" , {"name" : "foo" })
152
153
153
154
# Error message should include the fallback text
154
155
assert "not json" in str (exc .value )
0 commit comments