~ubuntu-branches/ubuntu/quantal/maas/quantal-proposed

« back to all changes in this revision

Viewing changes to src/maastesting/tests/test_fakemethod.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Andres Rodriguez, Gavin Panella, Raphael Badin
  • Date: 2012-10-16 10:31:37 UTC
  • mfrom: (1.2.1) (20.1.8 quantal)
  • Revision ID: package-import@ubuntu.com-20121016103137-f6h9izlca23r2oen
Tags: 0.1+bzr1269+dfsg-0ubuntu1
* New upstream bugfix release
  - Fixes commissioning failing to set memory attribute. (LP: #1064638)
  - Fixes node listing by adding pagination (LP: #1064672)
  - Changes default bind rndc key which breaks initscripts (LP: #1066938)
  - Fixes invalid DNS config once node is enlisted (LP: #1066958)
  - Reference documentation link to correct URL (LP: #1067261)

[ Andres Rodriguez ]
* debian/rules: Change upstream branch.

[ Gavin Panella ]
* debian/maas-dns.postinst: Remove MAAS-related include lines from named's
  config before adding a new one (LP: #1066929)

[ Raphael Badin ]
* debian/extras/maas-region-celeryd: Remove whitespace that affects DNS
  rabbitmq queue. (LP: #1067929)

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
__metaclass__ = type
13
13
__all__ = []
14
14
 
15
 
from maastesting.fakemethod import FakeMethod
 
15
from maastesting.fakemethod import (
 
16
    FakeMethod,
 
17
    MultiFakeMethod,
 
18
    )
16
19
from maastesting.testcase import TestCase
17
20
 
18
21
 
67
70
        stub = FakeMethod()
68
71
        stub(1, 2, 3, x=12)
69
72
        self.assertItemsEqual([{'x': 12}], stub.extract_kwargs())
 
73
 
 
74
 
 
75
class TestMultiFakeMethod(TestCase):
 
76
 
 
77
    def test_call_calls_all_given_methods(self):
 
78
        methods = FakeMethod(), FakeMethod()
 
79
        method = MultiFakeMethod(methods)
 
80
        call1_args = "input 1"
 
81
        call2_args = "input 2"
 
82
        method(call1_args)
 
83
        method(call2_args)
 
84
        self.assertEqual(
 
85
            [[('input 1',)], [('input 2',)]],
 
86
            [methods[0].extract_args(), methods[1].extract_args()])
 
87
 
 
88
    def test_raises_if_called_one_time_too_many(self):
 
89
        method = MultiFakeMethod([FakeMethod()])
 
90
        method()
 
91
        self.assertRaises(ValueError, method)