Beispiel #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())
Beispiel #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())
Beispiel #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)
Beispiel #4
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
            )