Пример #1
0
    def testBasic(self):
        s = FileUpload(slavesrc=__file__, masterdest=self.destfile)
        s.build = Mock()
        s.build.getProperties.return_value = Properties()
        s.build.getSlaveCommandVersion.return_value = 1

        s.step_status = Mock()
        s.buildslave = Mock()
        s.remote = Mock()

        s.start()

        for c in s.remote.method_calls:
            name, command, args = c
            commandName = command[3]
            kwargs = command[-1]
            if commandName == 'uploadFile':
                self.assertEquals(kwargs['slavesrc'], __file__)
                writer = kwargs['writer']
                writer.remote_write(open(__file__, "rb").read())
                self.assert_(not os.path.exists(self.destfile))
                writer.remote_close()
                break
        else:
            self.assert_(False, "No uploadFile command found")

        self.assertEquals(
            open(self.destfile, "rb").read(),
            open(__file__, "rb").read())
Пример #2
0
    def testTimestamp(self):
        s = FileUpload(slavesrc=__file__, masterdest=self.destfile, keepstamp=True)
        s.build = Mock()
        s.build.getProperties.return_value = Properties()
        s.build.getSlaveCommandVersion.return_value = "2.13"

        s.step_status = Mock()
        s.buildslave = Mock()
        s.remote = Mock()
        s.start()
        timestamp = ( os.path.getatime(__file__),
                      os.path.getmtime(__file__) )

        for c in s.remote.method_calls:
            name, command, args = c
            commandName = command[3]
            kwargs = command[-1]
            if commandName == 'uploadFile':
                self.assertEquals(kwargs['slavesrc'], __file__)
                writer = kwargs['writer']
                writer.remote_write(open(__file__, "rb").read())
                self.assert_(not os.path.exists(self.destfile))
                writer.remote_close()
                writer.remote_utime(timestamp)
                break
        else:
            self.assert_(False, "No uploadFile command found")

        desttimestamp = ( os.path.getatime(self.destfile),
                          os.path.getmtime(self.destfile) )
        self.assertAlmostEquals(timestamp[0],desttimestamp[0],places=5)
        self.assertAlmostEquals(timestamp[1],desttimestamp[1],places=5)
Пример #3
0
    def testTimestamp(self):
        s = FileUpload(slavesrc=__file__,
                       masterdest=self.destfile,
                       keepstamp=True)
        s.build = Mock()
        s.build.getProperties.return_value = Properties()
        s.build.getSlaveCommandVersion.return_value = "2.13"

        s.step_status = Mock()
        s.buildslave = Mock()
        s.remote = Mock()
        s.start()
        timestamp = (os.path.getatime(__file__), os.path.getmtime(__file__))

        for c in s.remote.method_calls:
            name, command, args = c
            commandName = command[3]
            kwargs = command[-1]
            if commandName == 'uploadFile':
                self.assertEquals(kwargs['slavesrc'], __file__)
                writer = kwargs['writer']
                writer.remote_write(open(__file__, "rb").read())
                self.assert_(not os.path.exists(self.destfile))
                writer.remote_close()
                writer.remote_utime(timestamp)
                break
        else:
            self.assert_(False, "No uploadFile command found")

        desttimestamp = (os.path.getatime(self.destfile),
                         os.path.getmtime(self.destfile))
        self.assertAlmostEquals(timestamp[0], desttimestamp[0], places=5)
        self.assertAlmostEquals(timestamp[1], desttimestamp[1], places=5)
Пример #4
0
    def testBasic(self):
        s = FileUpload(slavesrc=__file__, masterdest=self.destfile)
        s.build = Mock()
        s.build.getProperties.return_value = Properties()
        s.build.getSlaveCommandVersion.return_value = 1

        s.step_status = Mock()
        s.buildslave = Mock()
        s.remote = Mock()

        s.start()

        for c in s.remote.method_calls:
            name, command, args = c
            commandName = command[3]
            kwargs = command[-1]
            if commandName == 'uploadFile':
                self.assertEquals(kwargs['slavesrc'], __file__)
                writer = kwargs['writer']
                writer.remote_write(open(__file__, "rb").read())
                self.assert_(not os.path.exists(self.destfile))
                writer.remote_close()
                break
        else:
            self.assert_(False, "No uploadFile command found")

        self.assertEquals(open(self.destfile, "rb").read(),
                open(__file__, "rb").read())
Пример #5
0
    def testURL(self):
        s = FileUpload(slavesrc=__file__, masterdest=self.destfile, url="http://server/file")
        s.build = Mock()
        s.build.getProperties.return_value = Properties()
        s.build.getSlaveCommandVersion.return_value = "2.13"

        s.step_status = Mock()
        s.step_status.addURL = Mock()
        s.buildslave = Mock()
        s.remote = Mock()
        s.start()

        for c in s.remote.method_calls:
            name, command, args = c
            commandName = command[3]
            kwargs = command[-1]
            if commandName == 'uploadFile':
                self.assertEquals(kwargs['slavesrc'], __file__)
                writer = kwargs['writer']
                writer.remote_write(open(__file__, "rb").read())
                self.assert_(not os.path.exists(self.destfile))
                writer.remote_close()
                break
        else:
            self.assert_(False, "No uploadFile command found")

        s.step_status.addURL.assert_called_once_with(
            os.path.basename(self.destfile), "http://server/file")
Пример #6
0
    def testURL(self):
        s = FileUpload(slavesrc=__file__,
                       masterdest=self.destfile,
                       url="http://server/file")
        s.build = Mock()
        s.build.getProperties.return_value = Properties()
        s.build.getSlaveCommandVersion.return_value = "2.13"

        s.step_status = Mock()
        s.step_status.addURL = Mock()
        s.buildslave = Mock()
        s.remote = Mock()
        s.start()

        for c in s.remote.method_calls:
            name, command, args = c
            commandName = command[3]
            kwargs = command[-1]
            if commandName == 'uploadFile':
                self.assertEquals(kwargs['slavesrc'], __file__)
                writer = kwargs['writer']
                writer.remote_write(open(__file__, "rb").read())
                self.assert_(not os.path.exists(self.destfile))
                writer.remote_close()
                break
        else:
            self.assert_(False, "No uploadFile command found")

        s.step_status.addURL.assert_called_once_with(
            os.path.basename(self.destfile), "http://server/file")
Пример #7
0
    def start(self):
        props = self.build.getProperties()
        upload_path = props.getProperty("upload_path")

        if not upload_path:
            upload_path = self.default_upload_path

        self.masterdest = upload_path + "/" + self.dest_filename

        FileUpload.start(self)
Пример #8
0
    def start(self):
        if self.getProperty('release'):
            self.masterdest = '/var/www/TaskCoach-packages/release/%s' % self.getProperty('basefilename')

        FileUpload.start(self)

        if not self.getProperty('release'):
            url = 'http://www.fraca7.net/TaskCoach-packages/%s/%s' % (self.getProperty('branch') or '',
                                                                      self.getProperty('basefilename'))

            self.addURL('Download', url)
Пример #9
0
 def start(self):
     self.masterdest = '%s/%s-output-%s' % (self.getProperty('buildername'),
                                            self.getProperty('buildnumber'),
                                            self._dest)
     return FileUpload.start(self)
Пример #10
0
    def start(self):
        FileUpload.start(self)

        self.addURL('See', 'http://www.fraca7.net/pylint-%s.html' % self.getProperty('buildername'))