|
1 | | -from itertools import cycle |
| 1 | +# from itertools import cycle |
2 | 2 | from unittest.mock import patch |
3 | 3 |
|
4 | 4 | from model_bakery import baker |
@@ -161,34 +161,34 @@ def setUp(self): |
161 | 161 | ) |
162 | 162 | self.offline_agent = baker.make_recipe("agents.agent", site=site) |
163 | 163 |
|
164 | | - @patch("agents.models.Agent.nats_cmd") |
165 | | - @patch("time.sleep") |
166 | | - def test_auto_approve_task(self, mock_sleep, nats_cmd): |
167 | | - from .tasks import auto_approve_updates_task |
168 | | - |
169 | | - # Setup data |
170 | | - baker.make_recipe( |
171 | | - "winupdate.winupdate", |
172 | | - agent=cycle( |
173 | | - [self.online_agents[0], self.online_agents[1], self.offline_agent] |
174 | | - ), |
175 | | - _quantity=20, |
176 | | - ) |
177 | | - baker.make_recipe( |
178 | | - "winupdate.winupdate_approve", |
179 | | - agent=cycle( |
180 | | - [self.online_agents[0], self.online_agents[1], self.offline_agent] |
181 | | - ), |
182 | | - _quantity=3, |
183 | | - ) |
184 | | - |
185 | | - # run task synchronously |
186 | | - auto_approve_updates_task() |
187 | | - |
188 | | - # make sure the check_for_updates_task was run once for each online agent |
189 | | - self.assertEqual(nats_cmd.call_count, 2) |
190 | | - |
191 | | - # check if all of the created updates were approved |
192 | | - winupdates = WinUpdate.objects.all() |
193 | | - for update in winupdates: |
194 | | - self.assertEqual(update.action, "approve") |
| 164 | + # @patch("agents.models.Agent.nats_cmd") |
| 165 | + # @patch("time.sleep") |
| 166 | + # def test_auto_approve_task(self, mock_sleep, nats_cmd): |
| 167 | + # from .tasks import auto_approve_updates_task |
| 168 | + |
| 169 | + # # Setup data |
| 170 | + # baker.make_recipe( |
| 171 | + # "winupdate.winupdate", |
| 172 | + # agent=cycle( |
| 173 | + # [self.online_agents[0], self.online_agents[1], self.offline_agent] |
| 174 | + # ), |
| 175 | + # _quantity=20, |
| 176 | + # ) |
| 177 | + # baker.make_recipe( |
| 178 | + # "winupdate.winupdate_approve", |
| 179 | + # agent=cycle( |
| 180 | + # [self.online_agents[0], self.online_agents[1], self.offline_agent] |
| 181 | + # ), |
| 182 | + # _quantity=3, |
| 183 | + # ) |
| 184 | + |
| 185 | + # # run task synchronously |
| 186 | + # auto_approve_updates_task() |
| 187 | + |
| 188 | + # # make sure the check_for_updates_task was run once for each online agent |
| 189 | + # self.assertEqual(nats_cmd.call_count, 2) |
| 190 | + |
| 191 | + # # check if all of the created updates were approved |
| 192 | + # winupdates = WinUpdate.objects.all() |
| 193 | + # for update in winupdates: |
| 194 | + # self.assertEqual(update.action, "approve") |
0 commit comments