def _busy_test(self, xbusy, count=5):
     activities = [
         activity(activity_id=i, type_tag='Restore', state='Completed')
         for i in range(count)
     ]
     extra_jobs_status = 'Complete' if not xbusy else 'InProgress'
     activities.extend(
         activity(activity_id=i, type_tag='Backup', state=extra_jobs_status)
         for i in range(count))
     HTTPretty.register_uri(HTTPretty.GET,
                            self.url,
                            body=json.dumps(activities))
     self.assertEqual(self.agent.busy, xbusy)
 def _busy_test(self, xbusy, count=5):
     activities = [activity(activity_id=i,
                            type_tag='Restore',
                            state='Completed')
                   for i in range(count)]
     extra_jobs_status = 'Complete' if not xbusy else 'InProgress'
     activities.extend(activity(activity_id=i,
                                type_tag='Backup',
                                state=extra_jobs_status)
                       for i in range(count))
     HTTPretty.register_uri(HTTPretty.GET, self.url,
                            body=json.dumps(activities))
     self.assertEqual(self.agent.busy, xbusy)
 def _activity_test(self, method, xtype, xstatus, xcount):
     activities = [activity(activity_id=i,
                            type_tag=xtype,
                            state=xstatus)
                   for i in range(xcount)]
     HTTPretty.register_uri(HTTPretty.GET, self.url,
                            body=json.dumps(activities))
     result = list(getattr(self.agent, method))
     self.assertEqual(len(result), xcount)
     for a in result:
         self.assertEqual(a.type, xtype)
         self.assertEqual(a.state, xstatus)
 def _activity_test(self, method, xtype, xstatus, xcount):
     activities = [
         activity(activity_id=i, type_tag=xtype, state=xstatus)
         for i in range(xcount)
     ]
     HTTPretty.register_uri(HTTPretty.GET,
                            self.url,
                            body=json.dumps(activities))
     result = list(getattr(self.agent, method))
     self.assertEqual(len(result), xcount)
     for a in result:
         self.assertEqual(a.type, xtype)
         self.assertEqual(a.state, xstatus)
Exemplo n.º 5
0
 def setUp(self):
     self.activity = activity.from_dict(mock_activity.activity())