This repository was archived by the owner on Jun 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathtest_commit.py
More file actions
45 lines (36 loc) · 1.95 KB
/
test_commit.py
File metadata and controls
45 lines (36 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from unittest.mock import patch
from django.test import TransactionTestCase
from shared.django_apps.core.tests.factories import (
CommitFactory,
OwnerFactory,
PullFactory,
RepositoryFactory,
)
from ..commit import CommitCommands
class CommitCommandsTest(TransactionTestCase):
def setUp(self):
self.owner = OwnerFactory(username="codecov-user")
self.repository = RepositoryFactory()
self.commit = CommitFactory()
self.pull = PullFactory(repository_id=self.repository.repoid)
self.command = CommitCommands(self.owner, "github")
@patch("core.commands.commit.commit.GetFinalYamlInteractor.execute")
def test_get_final_yaml_delegate_to_interactor(self, interactor_mock):
self.command.get_final_yaml(self.commit)
interactor_mock.assert_called_once_with(self.commit)
@patch("core.commands.commit.commit.GetFileContentInteractor.execute")
def test_get_file_content_delegate_to_interactor(self, interactor_mock):
self.command.get_file_content(self.commit, "path/to/file")
interactor_mock.assert_called_once_with(self.commit, "path/to/file")
@patch("core.commands.commit.commit.GetCommitErrorsInteractor.execute")
def test_get_commit_errors_delegate_to_interactor(self, interactor_mock):
self.command.get_commit_errors(self.commit, "YAML_ERROR")
interactor_mock.assert_called_once_with(self.commit, "YAML_ERROR")
@patch("core.commands.commit.commit.GetUploadsNumberInteractor.execute")
def test_get_uploads_number_delegate_to_interactor(self, interactor_mock):
self.command.get_uploads_number(self.commit)
interactor_mock.assert_called_once_with(self.commit)
@patch("core.commands.commit.commit.GetLatestUploadErrorInteractor.execute")
def test_get_latest_upload_error_delegate_to_interactor(self, interactor_mock):
self.command.get_latest_upload_error(self.commit)
interactor_mock.assert_called_once_with(self.commit)