Skip to content

Commit

Permalink
Merge pull request #1 from ryneeverett/debianbts-mock
Browse files Browse the repository at this point in the history
Use mock for monkeypatching.
  • Loading branch information
irl committed Jul 25, 2016
2 parents 1f15f94 + 5cc1e64 commit 48f9590
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/test_bts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import bugwarrior.services.bts as bts
import mock

from bugwarrior.services import bts

from .base import ServiceTest, AbstractServiceTest

Expand Down Expand Up @@ -36,12 +38,6 @@ class TestBTSService(AbstractServiceTest, ServiceTest):
def setUp(self):
self.service = self.get_mock_service(bts.BTSService)

def get_mock_service(self, *args, **kwargs):
bts.debianbts = FakeBTSLib()
service = super(TestBTSService, self).get_mock_service(
*args, **kwargs)
return service

def test_to_taskwarrior(self):
issue = self.service.get_issue_for_record(
self.service._record_for_bug(FakeBTSBug)
Expand All @@ -63,7 +59,8 @@ def test_to_taskwarrior(self):
self.assertEqual(actual_output, expected_output)

def test_issues(self):
issue = next(self.service.issues())
with mock.patch('bugwarrior.services.bts.debianbts', FakeBTSLib()):
issue = next(self.service.issues())

expected = {
'btsnumber': 810629,
Expand Down

0 comments on commit 48f9590

Please sign in to comment.