Skip to content

Commit 85ba158

Browse files
committed
tests added
1 parent 3324f4f commit 85ba158

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

readthedocs/rtd_tests/tests/test_celery.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def test_fileify_logging_when_wrong_version_pk(self, mock_logger):
334334
mock_logger.warning.assert_called_with("Version not found for given kwargs. {'pk': 345343}")
335335

336336
@patch('readthedocs.projects.tasks.GitHubService.send_build_status')
337-
def test_send_build_status_task(self, send_build_status):
337+
def test_send_build_status_task_with_remote_repo(self, send_build_status):
338338
social_account = get(SocialAccount, provider='github')
339339
remote_repo = get(RemoteRepository, account=social_account, project=self.project)
340340
remote_repo.users.add(self.eric)
@@ -348,7 +348,22 @@ def test_send_build_status_task(self, send_build_status):
348348
send_build_status.assert_called_once_with(external_build, BUILD_STATUS_SUCCESS)
349349

350350
@patch('readthedocs.projects.tasks.GitHubService.send_build_status')
351-
def test_send_build_status_task_without_remote_repo(self, send_build_status):
351+
def test_send_build_status_task_with_social_account(self, send_build_status):
352+
social_account = get(SocialAccount, user=self.eric, provider='github')
353+
354+
self.project.repo = 'https://github.com/test/test/'
355+
self.project.save()
356+
357+
external_version = get(Version, project=self.project, type=EXTERNAL)
358+
external_build = get(
359+
Build, project=self.project, version=external_version
360+
)
361+
tasks.send_build_status(external_build.id, BUILD_STATUS_SUCCESS)
362+
363+
send_build_status.assert_called_once_with(external_build, BUILD_STATUS_SUCCESS)
364+
365+
@patch('readthedocs.projects.tasks.GitHubService.send_build_status')
366+
def test_send_build_status_task_without_remote_repo_or_social_account(self, send_build_status):
352367
external_version = get(Version, project=self.project, type=EXTERNAL)
353368
external_build = get(
354369
Build, project=self.project, version=external_version

0 commit comments

Comments
 (0)