Exemple #1
0
 def test_report_to_vt_pretend(self, requests_post):
     avt = AmavisVT(
         AmavisVTConfigurationParser(
             {"database-path": ":memory:", "api-key": "my-api-key", "pretend": "true"}, path="/dev/null"
         )
     )
     avt.report_to_vt(DummyResource("file1", "application/zip"))
     assert not requests_post.called
Exemple #2
0
 def test_report_to_vt_pretend(self, requests_post):
     avt = AmavisVT(
         AmavisVTConfigurationParser(
             {
                 'database-path': ':memory:',
                 'api-key': 'my-api-key',
                 'pretend': 'true'
             },
             path='/dev/null'))
     avt.report_to_vt(DummyResource('file1', 'application/zip'))
     assert not requests_post.called
Exemple #3
0
    def do_report(self, filename_argument):
        filename = os.path.abspath(filename_argument)
        if not (os.path.exists(filename) and os.path.isfile(filename) and os.access(filename, os.R_OK)):
            logger.error("File does not exist or is inaccessible: '%s'", filename)
            self.send_response("ERROR: File does not exist or is inaccessible: '%s'" % filename)
            return

        avt = AmavisVT(self.config)
        result = avt.report_to_vt(Resource(filename, cleanup=False, no_unpack=True))
        self.send_response(str(result) if result else "No response")
Exemple #4
0
    def do_report(self, filename_argument):
        filename = os.path.abspath(filename_argument)
        if not (os.path.exists(filename) and os.path.isfile(filename)
                and os.access(filename, os.R_OK)):
            logger.error("File does not exist or is inaccessible: '%s'",
                         filename)
            self.send_response(
                "ERROR: File does not exist or is inaccessible: '%s'" %
                filename)
            return

        avt = AmavisVT(self.config)
        result = avt.report_to_vt(
            Resource(filename, cleanup=False, no_unpack=True))
        self.send_response(str(result) if result else "No response")