コード例 #1
0
ファイル: test_models.py プロジェクト: sudheesh001/pontoon
 def test_can_commit_true(self):
     """
     can_commit should be True if there is a repo that can be
     committed to.
     """
     repo = RepositoryFactory.build(type=Repository.GIT)
     project = ProjectFactory.create(repositories=[repo])
     assert_true(project.can_commit)
コード例 #2
0
ファイル: test_models.py プロジェクト: sudheesh001/pontoon
 def test_can_commit_false(self):
     """
     can_commit should be False if there are no repo that can be
     committed to.
     """
     repo = RepositoryFactory.build(type=Repository.FILE)
     project = ProjectFactory.create(repositories=[repo])
     assert_false(project.can_commit)
コード例 #3
0
ファイル: test_models.py プロジェクト: dsaumyajit007/pontoon
 def test_can_commit_true(self):
     """
     can_commit should be True if there is a repo that can be
     committed to.
     """
     repo = RepositoryFactory.build(type=Repository.GIT)
     project = ProjectFactory.create(repositories=[repo])
     assert_true(project.can_commit)
コード例 #4
0
ファイル: test_models.py プロジェクト: dsaumyajit007/pontoon
 def test_can_commit_false(self):
     """
     can_commit should be False if there are no repo that can be
     committed to.
     """
     repo = RepositoryFactory.build(type=Repository.FILE)
     project = ProjectFactory.create(repositories=[repo])
     assert_false(project.can_commit)
コード例 #5
0
ファイル: test_vcs_models.py プロジェクト: rajul/pontoon
    def test_resource_for_path_region_properties(self):
        """
        If a project has a repository_url in pontoon.base.MOZILLA_REPOS,
        resources_for_path should ignore files named
        "region.properties".
        """
        url = "https://moz.example.com"
        self.project.repositories.all().delete()
        self.project.repositories.add(RepositoryFactory.build(url=url))

        with patch("pontoon.sync.vcs_models.os", wraps=os) as mock_os, patch(
            "pontoon.sync.vcs_models.MOZILLA_REPOS", [url]
        ):
            mock_os.walk.return_value = [("/root", [], ["foo.pot", "region.properties"])]

            assert_equal(list(self.vcs_project.resources_for_path("/root")), [os.path.join("/root", "foo.pot")])
コード例 #6
0
ファイル: test_vcs_models.py プロジェクト: yfdyh000/pontoon
    def test_resource_for_path_region_properties(self):
        """
        If a project has a repository_url in pontoon.base.MOZILLA_REPOS,
        resources_for_path should ignore files named
        "region.properties".
        """
        url = 'https://moz.example.com'
        self.project.repositories.all().delete()
        self.project.repositories.add(RepositoryFactory.build(url=url))

        with patch('pontoon.sync.vcs_models.os', wraps=os) as mock_os, \
             patch('pontoon.sync.vcs_models.MOZILLA_REPOS', [url]):
            mock_os.walk.return_value = [('/root', [],
                                          ['foo.pot', 'region.properties'])]

            assert_equal(list(self.vcs_project.resources_for_path('/root')),
                         [os.path.join('/root', 'foo.pot')])