コード例 #1
0
ファイル: tests.py プロジェクト: dekoza/weblate
    def test_clone(self):
        testdir = tempfile.mkdtemp()
        if self.acl:
            self.component.project.add_user(self.user, '@VCS')
        try:
            url = get_export_url(self.component).replace(
                'http://example.com', self.live_server_url
            ).replace(
                'http://', 'http://{0}:{1}@'.format(
                    self.user.username, self.user.auth_token.key
                )
            )
            process = subprocess.Popen(
                ['git', 'clone', url],
                cwd=testdir,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                stdin=subprocess.PIPE,
            )
            output = process.communicate()[0]
            retcode = process.poll()
        finally:
            shutil.rmtree(testdir)

        check = self.assertEqual if self.acl else self.assertNotEqual
        check(retcode, 0, 'Failed: {0}'.format(output))
コード例 #2
0
    def test_clone(self):
        testdir = tempfile.mkdtemp()
        if self.acl:
            self.component.project.add_user(self.user, '@VCS')
        try:
            url = (get_export_url(self.component).replace(
                'http://example.com', self.live_server_url).replace(
                    'http://',
                    'http://{0}:{1}@'.format(self.user.username,
                                             self.user.auth_token.key),
                ))
            process = subprocess.Popen(
                ['git', 'clone', url],
                cwd=testdir,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                stdin=subprocess.PIPE,
            )
            output = process.communicate()[0]
            retcode = process.poll()
        finally:
            shutil.rmtree(testdir)

        check = self.assertEqual if self.acl else self.assertNotEqual
        check(retcode, 0, 'Failed: {0}'.format(output))
コード例 #3
0
    def test_clone(self):
        testdir = tempfile.mkdtemp()
        if self.acl:
            self.component.project.add_user(self.user, "@VCS")
        try:
            url = (
                get_export_url(self.component)
                .replace("http://example.com", self.live_server_url)
                .replace(
                    "http://",
                    f"http://{self.user.username}:{self.user.auth_token.key}@",
                )
            )
            process = subprocess.Popen(
                ["git", "clone", url],
                cwd=testdir,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                stdin=subprocess.PIPE,
            )
            output = process.communicate()[0]
            retcode = process.poll()
        finally:
            remove_tree(testdir)

        check = self.assertEqual if self.acl else self.assertNotEqual
        check(retcode, 0, f"Failed: {output}")
コード例 #4
0
def set_export_url(apps, schema_editor):
    Component = apps.get_model('trans', 'Component')
    matching = Component.objects.filter(vcs__in=SUPPORTED_VCS).exclude(
        repo__startswith='weblate:/')
    for component in matching:
        new_url = get_export_url(component)
        if component.git_export != new_url:
            component.git_export = new_url
            component.save()
コード例 #5
0
def set_export_url(apps, schema_editor):
    Component = apps.get_model("trans", "Component")
    db_alias = schema_editor.connection.alias
    matching = (Component.objects.using(db_alias).filter(
        vcs__in=SUPPORTED_VCS).exclude(repo__startswith="weblate:/"))
    for component in matching:
        new_url = get_export_url(component)
        if component.git_export != new_url:
            component.git_export = new_url
            component.save()
コード例 #6
0
def set_export_url(apps, schema_editor):
    Component = apps.get_model('trans', 'Component')
    matching = Component.objects.filter(
        vcs__in=SUPPORTED_VCS
    ).exclude(
        repo__startswith='weblate:/'
    )
    for component in matching:
        new_url = get_export_url(component)
        if component.git_export != new_url:
            component.git_export = new_url
            component.save()
コード例 #7
0
ファイル: tests.py プロジェクト: lcsouzamenezes/weblate
 def test_get_export_url(self):
     self.assertEqual("http://example.com/git/test/test/",
                      get_export_url(self.component))
コード例 #8
0
 def test_get_export_url(self):
     self.assertEqual('http://example.com/git/test/test/',
                      get_export_url(self.subproject))
コード例 #9
0
ファイル: tests.py プロジェクト: nijel/weblate
 def test_get_export_url(self):
     self.assertEqual("http://example.com/git/test/test/", get_export_url(self.subproject))
コード例 #10
0
ファイル: tests.py プロジェクト: dekoza/weblate
 def test_get_export_url(self):
     self.assertEqual(
         'http://example.com/git/test/test/',
         get_export_url(self.component)
     )