Exemplo n.º 1
0
def symlink_domain(project_pk, domain_pk, delete=False):
    project = Project.objects.get(pk=project_pk)
    domain = Domain.objects.get(pk=domain_pk)
    sym = Symlink(project=project)
    if delete:
        sym.remove_symlink_cname(domain)
    else:
        sym.symlink_cnames(domain)
Exemplo n.º 2
0
def symlink_domain(project_pk, domain_pk, delete=False):
    project = Project.objects.get(pk=project_pk)
    domain = Domain.objects.get(pk=domain_pk)
    sym = Symlink(project=project)
    if delete:
        sym.remove_symlink_cname(domain)
    else:
        sym.symlink_cnames(domain)
Exemplo n.º 3
0
class TestSymlinkCnames(TestCase):

    def setUp(self):
        self.project = get(Project, slug='kong')
        self.version = get(Version, verbose_name='latest', active=True, project=self.project)
        self.symlink = Symlink(self.project)
        self.args = {
            'cname_root': self.symlink.CNAME_ROOT,
            'project_root': self.symlink.project_root,
        }
        self.commands = []

    @patched
    def test_symlink_cname(self):
        self.cname = get(Domain, project=self.project, url='http://woot.com', cname=True)
        self.symlink.symlink_cnames()
        self.args['cname'] = self.cname.domain
        commands = [
            'ln -nsf {project_root} {cname_root}/{cname}',
        ]

        for index, command in enumerate(commands):
            self.assertEqual(self.commands[index], command.format(**self.args))