@@ -13,7 +13,7 @@ def setUp(self):
13
13
@patch ("yeti.api.requests.Session.post" )
14
14
def test_auth_api_key (self , mock_post ):
15
15
mock_response = MagicMock ()
16
- mock_response .bytes = b'{"access_token": "fake_token"}'
16
+ mock_response .content = b'{"access_token": "fake_token"}'
17
17
mock_post .return_value = mock_response
18
18
19
19
self .api .auth_api_key ("fake_apikey" )
@@ -26,7 +26,7 @@ def test_auth_api_key(self, mock_post):
26
26
@patch ("yeti.api.requests.Session.post" )
27
27
def test_search_indicators (self , mock_post ):
28
28
mock_response = MagicMock ()
29
- mock_response .bytes = b'{"indicators": [{"name": "test"}]}'
29
+ mock_response .content = b'{"indicators": [{"name": "test"}]}'
30
30
mock_post .return_value = mock_response
31
31
32
32
result = self .api .search_indicators (name = "test" )
@@ -39,7 +39,7 @@ def test_search_indicators(self, mock_post):
39
39
@patch ("yeti.api.requests.Session.post" )
40
40
def test_search_entities (self , mock_post ):
41
41
mock_response = MagicMock ()
42
- mock_response .bytes = b'{"entities": [{"name": "test_entity"}]}'
42
+ mock_response .content = b'{"entities": [{"name": "test_entity"}]}'
43
43
mock_post .return_value = mock_response
44
44
45
45
result = self .api .search_entities (name = "test_entity" )
@@ -52,7 +52,7 @@ def test_search_entities(self, mock_post):
52
52
@patch ("yeti.api.requests.Session.post" )
53
53
def test_search_observables (self , mock_post ):
54
54
mock_response = MagicMock ()
55
- mock_response .bytes = b'{"observables": [{"value": "test_value"}]}'
55
+ mock_response .content = b'{"observables": [{"value": "test_value"}]}'
56
56
mock_post .return_value = mock_response
57
57
58
58
result = self .api .search_observables (value = "test_value" )
@@ -65,8 +65,8 @@ def test_search_observables(self, mock_post):
65
65
@patch ("yeti.api.requests.Session.post" )
66
66
def test_new_entity (self , mock_post ):
67
67
mock_response = MagicMock ()
68
- mock_response .bytes = b'{"id": "new_entity"}'
69
- mock_response .bytes = b'{"id": "new_entity"}'
68
+ mock_response .content = b'{"id": "new_entity"}'
69
+ mock_response .content = b'{"id": "new_entity"}'
70
70
mock_post .return_value = mock_response
71
71
72
72
result = self .api .new_entity ({"name" : "test_entity" })
@@ -79,7 +79,7 @@ def test_new_entity(self, mock_post):
79
79
@patch ("yeti.api.requests.Session.post" )
80
80
def test_new_indicator (self , mock_post ):
81
81
mock_response = MagicMock ()
82
- mock_response .bytes = b'{"id": "new_indicator"}'
82
+ mock_response .content = b'{"id": "new_indicator"}'
83
83
mock_post .return_value = mock_response
84
84
85
85
result = self .api .new_indicator ({"name" : "test_indicator" })
@@ -92,7 +92,7 @@ def test_new_indicator(self, mock_post):
92
92
@patch ("yeti.api.requests.Session.patch" )
93
93
def test_patch_indicator (self , mock_patch ):
94
94
mock_response = MagicMock ()
95
- mock_response .bytes = b'{"id": "patched_indicator"}'
95
+ mock_response .content = b'{"id": "patched_indicator"}'
96
96
mock_patch .return_value = mock_response
97
97
98
98
result = self .api .patch_indicator (1 , {"name" : "patched_indicator" })
@@ -105,7 +105,7 @@ def test_patch_indicator(self, mock_patch):
105
105
@patch ("yeti.api.requests.Session.post" )
106
106
def test_search_dfiq (self , mock_post ):
107
107
mock_response = MagicMock ()
108
- mock_response .bytes = b'{"dfiq": [{"name": "test_dfiq"}]}'
108
+ mock_response .content = b'{"dfiq": [{"name": "test_dfiq"}]}'
109
109
mock_post .return_value = mock_response
110
110
111
111
result = self .api .search_dfiq (name = "test_dfiq" )
@@ -118,7 +118,7 @@ def test_search_dfiq(self, mock_post):
118
118
@patch ("yeti.api.requests.Session.post" )
119
119
def test_new_dfiq_from_yaml (self , mock_post ):
120
120
mock_response = MagicMock ()
121
- mock_response .bytes = b'{"id": "new_dfiq"}'
121
+ mock_response .content = b'{"id": "new_dfiq"}'
122
122
mock_post .return_value = mock_response
123
123
124
124
result = self .api .new_dfiq_from_yaml ("type" , "yaml_content" )
@@ -135,7 +135,7 @@ def test_new_dfiq_from_yaml(self, mock_post):
135
135
@patch ("yeti.api.requests.Session.patch" )
136
136
def test_patch_dfiq_from_yaml (self , mock_patch ):
137
137
mock_response = MagicMock ()
138
- mock_response .bytes = b'{"id": "patched_dfiq"}'
138
+ mock_response .content = b'{"id": "patched_dfiq"}'
139
139
mock_patch .return_value = mock_response
140
140
141
141
result = self .api .patch_dfiq_from_yaml ("type" , "yaml_content" , 1 )
@@ -152,7 +152,7 @@ def test_patch_dfiq_from_yaml(self, mock_patch):
152
152
@patch ("yeti.api.requests.Session.post" )
153
153
def test_download_dfiq_archive (self , mock_post ):
154
154
mock_response = MagicMock ()
155
- mock_response .bytes = b"archive_content"
155
+ mock_response .content = b"archive_content"
156
156
mock_post .return_value = mock_response
157
157
158
158
result = self .api .download_dfiq_archive ()
@@ -165,7 +165,7 @@ def test_download_dfiq_archive(self, mock_post):
165
165
@patch ("yeti.api.requests.Session.post" )
166
166
def test_upload_dfiq_archive (self , mock_post ):
167
167
mock_response = MagicMock ()
168
- mock_response .bytes = b'{"uploaded": 1}'
168
+ mock_response .content = b'{"uploaded": 1}'
169
169
mock_post .return_value = mock_response
170
170
171
171
with patch ("builtins.open" , unittest .mock .mock_open (read_data = b"data" )):
@@ -182,7 +182,7 @@ def test_upload_dfiq_archive(self, mock_post):
182
182
@patch ("yeti.api.requests.Session.post" )
183
183
def test_add_observable (self , mock_post ):
184
184
mock_response = MagicMock ()
185
- mock_response .bytes = b'{"id": "new_observable"}'
185
+ mock_response .content = b'{"id": "new_observable"}'
186
186
mock_post .return_value = mock_response
187
187
188
188
result = self .api .add_observable ("value" , "type" )
@@ -195,7 +195,7 @@ def test_add_observable(self, mock_post):
195
195
@patch ("yeti.api.requests.Session.post" )
196
196
def test_add_observables_bulk (self , mock_post ):
197
197
mock_response = MagicMock ()
198
- mock_response .bytes = b'{"added": [], "failed": []}'
198
+ mock_response .content = b'{"added": [], "failed": []}'
199
199
mock_post .return_value = mock_response
200
200
201
201
result = self .api .add_observables_bulk ([{"value" : "value" , "type" : "type" }])
@@ -208,7 +208,7 @@ def test_add_observables_bulk(self, mock_post):
208
208
@patch ("yeti.api.requests.Session.post" )
209
209
def test_tag_object (self , mock_post ):
210
210
mock_response = MagicMock ()
211
- mock_response .bytes = b'{"id": "tagged_object"}'
211
+ mock_response .content = b'{"id": "tagged_object"}'
212
212
mock_post .return_value = mock_response
213
213
214
214
result = self .api .tag_object ({"id" : "1" , "root_type" : "indicator" }, ["tag1" ])
@@ -221,7 +221,7 @@ def test_tag_object(self, mock_post):
221
221
@patch ("yeti.api.requests.Session.post" )
222
222
def test_link_objects (self , mock_post ):
223
223
mock_response = MagicMock ()
224
- mock_response .bytes = b'{"id": "link"}'
224
+ mock_response .content = b'{"id": "link"}'
225
225
mock_post .return_value = mock_response
226
226
227
227
result = self .api .link_objects (
@@ -243,7 +243,7 @@ def test_link_objects(self, mock_post):
243
243
@patch ("yeti.api.requests.Session.post" )
244
244
def test_search_graph (self , mock_post ):
245
245
mock_response = MagicMock ()
246
- mock_response .bytes = b'{"graph": "data"}'
246
+ mock_response .content = b'{"graph": "data"}'
247
247
mock_post .return_value = mock_response
248
248
249
249
result = self .api .search_graph ("source" , "graph" , ["type" ])
0 commit comments