Example #1
0
 def _makeOnePopulated(self,
                       programs,
                       any,
                       response=None,
                       exc=None,
                       gcore=None,
                       coredir=None,
                       eager=True):
     if response is None:
         response = DummyResponse()
     rpc = DummyRPCServer()
     sendmail = 'cat - > /dev/null'
     email = '*****@*****.**'
     url = 'http://foo/bar'
     timeout = 10
     retry_time = 0
     status = '200'
     inbody = None
     gcore = gcore
     coredir = coredir
     prog = self._makeOne(rpc, programs, any, url, timeout, status, inbody,
                          email, sendmail, coredir, gcore, eager,
                          retry_time)
     prog.stdin = StringIO()
     prog.stdout = StringIO()
     prog.stderr = StringIO()
     prog.connclass = make_connection(response, exc=exc)
     return prog
Example #2
0
    def _make_one_mocked(self, **kwargs):
        kwargs['stdin'] = StringIO()
        kwargs['stdout'] = StringIO()
        kwargs['stderr'] = StringIO()

        obj = self._get_target_class()(**kwargs)
        obj.send_batch_notification = Mock()
        return obj
Example #3
0
    def _make_one(self, **kwargs):
        kwargs['stdin'] = StringIO()
        kwargs['stdout'] = StringIO()
        kwargs['stderr'] = StringIO()
        kwargs['from_email'] = kwargs.get('from_email', self.from_email)
        kwargs['to_emails'] = kwargs.get('to_emails', self.to_emails)
        kwargs['subject'] = kwargs.get('subject', self.subject)

        obj = self._get_target_class()(**kwargs)
        return obj
Example #4
0
 def _makeOnePopulated(self, programs, groups, any):
     rpc = DummyRPCServer()
     cumulative = False
     sendmail = 'cat - > /dev/null'
     email = '*****@*****.**'
     name = 'test'
     uptime_limit = 2000
     memmon = self._makeOne(cumulative, programs, groups, any, sendmail, email, uptime_limit, name, rpc)
     memmon.stdin = StringIO()
     memmon.stdout = StringIO()
     memmon.stderr = StringIO()
     memmon.pscommand = 'echo 22%s'
     return memmon
Example #5
0
 def _makeOnePopulated(self, programs, groups, any, name=None):
     memmon = self._makeOne(
         programs=programs,
         groups=groups,
         any=any,
         name=name,
         rpc=DummyRPCServer(),
         cumulative=False,
         sendmail='cat - > /dev/null',
         email='*****@*****.**',
         email_uptime_limit=2000,
         )
     memmon.stdin = StringIO()
     memmon.stdout = StringIO()
     memmon.stderr = StringIO()
     memmon.pscommand = 'echo 22%s'
     return memmon