Пример #1
0
    def test_no_authors(self):
        """
        If no authors are found in the changeset, default to a fake
        "Pontoon" user.
        """
        self.changeset.commit_authors_per_locale = {
            self.translated_locale.code: []
        }
        self.db_project.repository_for_path = Mock(
            return_value=self.repository)

        commit_changes(self.db_project, self.vcs_project, self.changeset)
        self.repository.commit.assert_called_with(
            NOT(CONTAINS('Authors:')),  # Don't list authors in commit
            ANY,
            os.path.join(FAKE_CHECKOUT_PATH, self.translated_locale.code))
        user = self.mock_repo_commit.call_args[0][1]
        assert_equal(user.first_name, 'Pontoon')
        assert_equal(user.email, '*****@*****.**')
Пример #2
0
    def test_commit_changes_no_authors(self):
        """
        If no authors are found in the changeset, default to a fake
        "Pontoon" user.
        """
        self.changeset.commit_authors_per_locale = {
            self.translated_locale.code: []
        }

        self.command.commit_changes(self.db_project, self.vcs_project, self.changeset)
        self.mock_commit_to_vcs.assert_called_with(
            'git',
            os.path.join(FAKE_CHECKOUT_PATH, self.translated_locale.code),
            NOT(CONTAINS('Authors:')),  # Don't list authors in commit
            ANY,
            'https://example.com/git'
        )
        user = self.mock_commit_to_vcs.call_args[0][3]
        assert_equal(user.first_name, 'Pontoon')
        assert_equal(user.email, '*****@*****.**')