Exemplo n.º 1
0
    def test_copy__deals_with_binary_files(self):

        source = self.tmpdir.join('hello.ico')
        source.write(b'\x00\x00\x01\x00\x02\x00\x10\x10\x00\x00', 'wb')

        destination = self.tmpdir.join('copy_hello.ico')

        repo = TemplateRepo()

        repo.copy('super', str(source), str(destination))

        assert destination.read() == '\x00\x00\x01\x00\x02\x00\x10\x10\x00\x00'
Exemplo n.º 2
0
    def test_copy(self):

        source = self.tmpdir.join('hello.ts')
        source.write('hello there')

        destination = self.tmpdir.join('copy_hello.ts')

        repo = TemplateRepo()

        repo.copy('super', str(source), str(destination))

        assert destination.read() == 'hello there'
Exemplo n.º 3
0
    def test_copy__replaces_prefix(self):

        source = self.tmpdir.join('hello.ts')
        source.write(
            textwrap.dedent('''
            hello __CLIENT_PREFIX__

            __CLIENT_PREFIX__ is cool.
        '''))

        destination = self.tmpdir.join('copy_hello.ts')

        repo = TemplateRepo()

        repo.copy('super', str(source), str(destination))

        assert destination.read() == textwrap.dedent('''
            hello super

            super is cool.
        ''')