예제 #1
0
    def test_file_continue(self):
        arg_parser = AppArgumentParser()
        args = arg_parser.parse_args([self.get_url("/static/my_file.txt"), "--continue", "--debug"])

        filename = os.path.join(self.temp_dir.name, "my_file.txt")

        with open(filename, "wb") as out_file:
            out_file.write(b"START")

        app = Builder(args, unit_test=True).build()
        exit_code = yield from app.run()

        self.assertEqual(0, exit_code)

        with open(filename, "rb") as in_file:
            data = in_file.read()

            self.assertEqual("54388a281352fdb2cfa66009ac0e35dd8916af7c", hashlib.sha1(data).hexdigest())
예제 #2
0
    def test_file_continue(self):
        arg_parser = AppArgumentParser()
        args = arg_parser.parse_args(
            [self.get_url('/static/my_file.txt'), '--continue', '--debug'])

        filename = os.path.join(self.temp_dir.name, 'my_file.txt')

        with open(filename, 'wb') as out_file:
            out_file.write(b'START')

        app = Builder(args, unit_test=True).build()
        exit_code = yield from app.run()

        self.assertEqual(0, exit_code)

        with open(filename, 'rb') as in_file:
            data = in_file.read()

            self.assertEqual('54388a281352fdb2cfa66009ac0e35dd8916af7c',
                             hashlib.sha1(data).hexdigest())
예제 #3
0
    def test_file_continue(self):
        arg_parser = AppArgumentParser()
        args = arg_parser.parse_args(
            [self.get_url('/example (copy).txt'), '--continue', '--debug'])

        filename = os.path.join(self.temp_dir.name, 'example (copy).txt')

        with open(filename, 'wb') as out_file:
            out_file.write(b'The')

        app = Builder(args, unit_test=True).build()
        exit_code = yield from app.run()

        self.assertEqual(0, exit_code)

        with open(filename, 'rb') as in_file:
            data = in_file.read()

            self.assertEqual(
                'The real treasure is in Smaug’s heart 💗.\n'.encode(
                    'utf-8'), data)
예제 #4
0
파일: ftp_test.py 프로젝트: Super-Rad/wpull
    def test_file_continue(self):
        arg_parser = AppArgumentParser()
        args = arg_parser.parse_args([self.get_url('/example (copy).txt'),
                                      '--continue', '--debug'])

        filename = os.path.join(self.temp_dir.name, 'example (copy).txt')

        with open(filename, 'wb') as out_file:
            out_file.write(b'The')

        app = Builder(args, unit_test=True).build()
        exit_code = yield from app.run()

        self.assertEqual(0, exit_code)

        with open(filename, 'rb') as in_file:
            data = in_file.read()

            self.assertEqual(
                'The real treasure is in Smaug’s heart 💗.\n'
                    .encode('utf-8'),
                data
            )