~cprov/uci-engine/boottest-probe

« back to all changes in this revision

Viewing changes to image-watcher/imagewatcher/tests/test_trigger_process.py

  • Committer: Ubuntu CI Bot
  • Author(s): Parameswaran Sivatharman
  • Date: 2015-01-17 11:17:34 UTC
  • mfrom: (920.2.11 uci-engine)
  • Revision ID: ubuntu_ci_bot-20150117111734-lkf7x2f0cb7ujlsb
Image watcher to trigger the workflow for when a new image available in http://cloud-images.ubuntu.com/ [r=Paul Larson, Celso Providelo]

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2015 Canonical Ltd.
 
2
 
 
3
# This program is free software: you can redistribute it and/or modify it
 
4
# under the terms of the GNU Affero General Public License version 3, as
 
5
# published by the Free Software Foundation.
 
6
 
 
7
# This program is distributed in the hope that it will be useful, but
 
8
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
9
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
10
# PURPOSE.  See the GNU Affero General Public License for more details.
 
11
 
 
12
# You should have received a copy of the GNU Affero General Public License
 
13
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
14
 
 
15
import unittest
 
16
 
 
17
 
 
18
from ucitests import assertions
 
19
 
 
20
 
 
21
from imagewatcher import trigger_process
 
22
from ci_utils.testing import fixtures
 
23
 
 
24
 
 
25
class TestPost(unittest.TestCase):
 
26
 
 
27
    def test_trigger_simple(self):
 
28
        queue = fixtures.FakeTaskQueue('that_queue')
 
29
        trigger_process.post(queue, 111, 'ubuntu-core/devel', 'lp:fake')
 
30
        assertions.assertLength(self, 1, queue.msgs)
 
31
        self.assertEqual(dict(channel='ubuntu-core/devel', revision=111,
 
32
                              test_branch='lp:fake'),
 
33
                         queue.msgs[0])
 
34
 
 
35
    def test_trigger_with_output(self):
 
36
        queue = fixtures.FakeTaskQueue('that_queue')
 
37
        trigger_process.post(queue,  111, 'ubuntu-core/devel', 'lp:fake',
 
38
                             'this_queue')
 
39
        assertions.assertLength(self, 1, queue.msgs)
 
40
        self.assertEqual(dict(channel='ubuntu-core/devel', revision=111,
 
41
                              test_branch='lp:fake',
 
42
                              output_queue='this_queue'),
 
43
                         queue.msgs[0])