~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/jobs/tests/test_changelog.py

  • Committer: Aaron Bentley
  • Date: 2013-02-12 18:57:02 UTC
  • mfrom: (149 charmworld)
  • mto: This revision was merged to the branch mainline in revision 150.
  • Revision ID: aaron@canonical.com-20130212185702-9gnf40ao17a7uw7v
Merged trunk into mongo-urls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
from charmworld.testing import get_bad_mock
9
9
from charmworld.testing import JobTestBase
10
 
from charmworld.jobs.changelog import scan_changes
 
10
from charmworld.jobs.worker import scan_changes
11
11
 
12
12
 
13
13
class TestChangelogJob(JobTestBase):
14
14
 
15
 
    @patch('charmworld.jobs.changelog.fetch_changes', get_bad_mock())
 
15
    # Patch has to happen along `worker` path rather than the `ingest` module
 
16
    # b/c of Mock/import interactions.
 
17
    @patch('charmworld.jobs.worker.fetch_changes', get_bad_mock())
16
18
    def test_scan_changes_records_failures(self):
17
19
        handler = self.get_handler("charm.changelog")
18
20
        charm_data = {'branch_dir': 'foo', 'branch_spec': 'bar'}
23
25
                   "u'foo'}: Exception forced by mock.")
24
26
        self.assertIn(err_msg, log_messages)
25
27
 
26
 
    @patch('charmworld.jobs.changelog.fetch_changes',
 
28
    # Patch has to happen along `worker` path rather than the `ingest` module
 
29
    # b/c of Mock/import interactions.
 
30
    @patch('charmworld.jobs.worker.fetch_changes',
27
31
           get_bad_mock(InvalidRevisionSpec, 'foo', 'bar'))
28
32
    def test_scan_changes_records_failures_bad_revision(self):
29
33
        handler = self.get_handler("charm.changelog")
34
38
        err_msg = ('bzr invalid rev on bar foo')
35
39
        self.assertIn(err_msg, log_messages)
36
40
 
37
 
    @patch('charmworld.jobs.changelog.fetch_changes', Mock())
 
41
    # Patch has to happen along `worker` path rather than the `ingest` module
 
42
    # b/c of Mock/import interactions.
 
43
    @patch('charmworld.jobs.worker.fetch_changes', Mock())
38
44
    def test_scan_changes(self):
39
45
        # If there are no errors charm is passed on to the out_queue
40
46
        charm_data = {'branch_dir': 'foo', 'branch_spec': 'bar'}