Esempio n. 1
0
 def test_alias_update(self):
     self._deploy()
     with commands.deploy(self.cfg, '2.0'):
         pass
     commands.alias(self.cfg, '2.0', ['latest'], update_aliases=True)
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_state(r'^Copied 2\.0 to latest', [
         versions.VersionInfo('2.0', '2.0', ['latest']),
         versions.VersionInfo('1.0', '1.0'),
     ])
Esempio n. 2
0
    def test_alias_from_version(self):
        self._deploy()
        commands.alias(self.cfg, '1.0', ['greatest'])
        check_call_silent(['git', 'checkout', 'gh-pages'])
        self._test_alias()

        with open('greatest/page.html') as f:
            self.assertRegex(f.read(), match_redir('../1.0/page.html'))
        with open('greatest/dir/index.html') as f:
            self.assertRegex(f.read(), match_redir('../../1.0/dir/'))
Esempio n. 3
0
 def test_alias_overwrite_error(self):
     self._deploy()
     with commands.deploy(self.cfg, '2.0'):
         pass
     with self.assertRaises(ValueError):
         commands.alias(self.cfg, '2.0', ['latest'])
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_state(r'^Deployed \w+ to 2\.0', [
         versions.VersionInfo('2.0', '2.0'),
         versions.VersionInfo('1.0', '1.0', ['latest']),
     ])
Esempio n. 4
0
    def test_alias_no_directory_urls(self):
        self._deploy()
        self.cfg.use_directory_urls = False
        commands.alias(self.cfg, '1.0', ['greatest'])
        check_call_silent(['git', 'checkout', 'gh-pages'])
        self._test_alias()

        with open('greatest/page.html') as f:
            self.assertRegex(f.read(), match_redir('../1.0/page.html'))
        with open('greatest/dir/index.html') as f:
            self.assertRegex(f.read(), match_redir('../../1.0/dir/index.html'))
Esempio n. 5
0
    def test_alias_custom_redirect(self):
        self._deploy()
        with mock.patch('builtins.open',
                        mock.mock_open(read_data=b'{{href}}')):
            commands.alias(self.cfg,
                           '1.0', ['greatest'],
                           template='template.html')
        check_call_silent(['git', 'checkout', 'gh-pages'])
        self._test_alias()

        with open('greatest/page.html') as f:
            self.assertEqual(f.read(), '../1.0/page.html')
        with open('greatest/dir/index.html') as f:
            self.assertEqual(f.read(), '../../1.0/dir/')
Esempio n. 6
0
 def test_prefix(self):
     self._deploy(prefix='prefix')
     commands.alias(self.cfg, '1.0', ['greatest'], prefix='prefix')
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_alias(directory='prefix')
Esempio n. 7
0
 def test_commit_message(self):
     self._deploy()
     commands.alias(self.cfg, '1.0', ['greatest'], message='commit message')
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_alias('^commit message$')
Esempio n. 8
0
 def test_branch(self):
     self._deploy('branch')
     commands.alias(self.cfg, '1.0', ['greatest'], branch='branch')
     check_call_silent(['git', 'checkout', 'branch'])
     self._test_alias()
Esempio n. 9
0
 def test_alias_overwrite_include_same(self):
     self._deploy()
     commands.alias(self.cfg, '1.0', ['latest', 'greatest'])
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_alias(expected_aliases=['latest', 'greatest'])
Esempio n. 10
0
 def test_alias_copy(self):
     self._deploy()
     commands.alias(self.cfg, '1.0', ['greatest'], redirect=False)
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_alias(redirect=['latest'])
Esempio n. 11
0
 def test_alias_from_alias(self):
     self._deploy()
     commands.alias(self.cfg, 'latest', ['greatest'])
     check_call_silent(['git', 'checkout', 'gh-pages'])
     self._test_alias()