~ubuntu-branches/ubuntu/raring/maas/raring

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_signals.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Raphaël Badin, Julian Edwards, Andres Rodriguez, Gavin Panella, Jeroen Vermeulen
  • Date: 2012-11-13 14:58:21 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20121113145821-6jq53jtljo3qou80
Tags: 1.2+bzr1349+dfsg-0ubuntu1
* New upstream bugfix release. Fixes:
  - The DNS configuration is not created if maas-dns is installed after
    the DNS config has been set up (LP: #1085865).
  - IPMI detection ends up with power_address of 0.0.0.0 (LP: #1064224)
  - Main page slow to load with many nodes (LP: #1066775)
  - maas-cluster-controller doesn't have images for
    provisioning (LP: #1068843)
  - Filestorage is unique to each appserver instance (LP: #1069734)
  - import_pxe_files does not include quantal (LP: #1069850)
  - maas-cli nodes new incomplete documentation (LP: #1070522)
  - DNS forward zone ends up with nonsensical entries (LP: #1070765)
  - The hostname of a node can still be changed once the node is in
    use. (LP: #1070774)
  - The zone name (attached to a cluster controller) can still be changed
    when it contains in-use nodes and DNS is managed. (LP: #1070775)
  - Duplicated prefix in the url used by the CLI (LP: #1075597)
  - Not importing Quantal boot images (LP: #1077180)
  - Nodes are deployed with wrong domain name. (LP: #1078744)
  - src/maasserver/api.py calls request.data.getlist with a 'default'
    parameter. That parameter is not supported by Django 1.3. (LP: #1080673)
  - API calls that return a node leak private data (LP: #1034318)
  - MAAS hostnames should be 5 easily disambiguated characters (LP: #1058998)
  - URI in API description wrong when accessing machine via alternative
    interface. (LP: #1059645)
  - Oops when renaming nodegroup w/o interface (LP: #1077075)
  - Error in log when using 'Start node' button: MAASAPINotFound: No user
    data available for this node. (LP: #1069603)

[ Raphaël Badin ]
* debian/maas-dns.postinst: Call write_dns_config (LP: #1085865).
* debian/maas-dns.postinst: fix permissions and group ownership of
  file /etc/bind/maas/named.conf.rndc.maas. (LP: #1066935)

[ Julian Edwards ]
* debian/maas-region-controller.install: Remove installation of maas-gc; it
  is no longer required as upstream no longer stores files in the filesystem.
  (LP: #1069734)
* debian/maas-cluster-controller.postinst: Ensure that /etc/maas/pserv.yaml
  is updated when reconfiguring. (LP: #1081212)

[ Andres Rodriguez ]
* debian/control:
  - maas-cluster-controller Conflicts with tftpd-hpa (LP: #1076028)
  - maas-dns: Conflicts with dnsmasq
  - Drop Dependency on rabbitmq-server for maas-cluster-controller.
    (LP: #1072744)
  - Add conflicts/replaces for maas-region-controller to
    maas-cluster-controller.
* debian/maas-cluster-controller.config: If URL has been detected, add
  /MAAS if it doesn't contain it. This helps upgrades from versions where
  DEFAULT_MAAS_URL didn't use /MAAS.
* Install maas-import-pxe-files and related files with
  maas-cluster-controller, as well as configure tgtd, as
  maas-region-controller no longer stores images. Thanks to Jeroen
  Vermuelen.

[ Gavin Panella ]
* debian/extras/99-maas: squashfs image download is no longer needed.
* debian/maas-cluster-controller.install: maas-import-squashfs and its
  configuration file are no longer part of upstream.

[ Jeroen Vermeulen ]
* debian/maas-cluster-controller.maas-pserv.upstart: Source maas_cluster.conf
  before starting pserv (tftpd) process.
* debian/maas-cluster-controller.postinst: Duplicate CLUSTER_UUID setting
  to maas_cluster.conf.
* Bumped revision number to current 1.2 revision 1342 (requested by rvba).

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
from maasserver.testing.factory import factory
17
17
from maasserver.testing.testcase import TestModelTestCase
18
18
from maasserver.tests.models import FieldChangeTestModel
19
 
from maastesting.fakemethod import FakeMethod
 
19
from mock import (
 
20
    call,
 
21
    Mock,
 
22
    )
20
23
 
21
24
 
22
25
class ConnectToFieldChangeTest(TestModelTestCase):
25
28
    app = 'maasserver.tests'
26
29
 
27
30
    def test_connect_to_field_change_calls_callback(self):
28
 
        callback = FakeMethod()
 
31
        callback = Mock()
29
32
        connect_to_field_change(callback, FieldChangeTestModel, 'name1')
30
33
        old_name1_value = factory.getRandomString()
31
34
        obj = FieldChangeTestModel(name1=old_name1_value)
33
36
        obj.name1 = factory.getRandomString()
34
37
        obj.save()
35
38
        self.assertEqual(
36
 
            (1, [(obj, old_name1_value)]),
37
 
            (callback.call_count, callback.extract_args()))
 
39
            (1, call(obj, old_name1_value, deleted=False)),
 
40
            (callback.call_count, callback.call_args))
38
41
 
39
42
    def test_connect_to_field_change_calls_callback_for_each_save(self):
40
 
        callback = FakeMethod()
 
43
        callback = Mock()
41
44
        connect_to_field_change(callback, FieldChangeTestModel, 'name1')
42
45
        old_name1_value = factory.getRandomString()
43
46
        obj = FieldChangeTestModel(name1=old_name1_value)
49
52
        self.assertEqual(2, callback.call_count)
50
53
 
51
54
    def test_connect_to_field_change_calls_callback_for_each_real_save(self):
52
 
        callback = FakeMethod()
 
55
        callback = Mock()
53
56
        connect_to_field_change(callback, FieldChangeTestModel, 'name1')
54
57
        old_name1_value = factory.getRandomString()
55
58
        obj = FieldChangeTestModel(name1=old_name1_value)
60
63
        self.assertEqual(1, callback.call_count)
61
64
 
62
65
    def test_connect_to_field_change_calls_multiple_callbacks(self):
63
 
        callback1 = FakeMethod()
 
66
        callback1 = Mock()
64
67
        connect_to_field_change(callback1, FieldChangeTestModel, 'name1')
65
 
        callback2 = FakeMethod()
 
68
        callback2 = Mock()
66
69
        connect_to_field_change(callback2, FieldChangeTestModel, 'name1')
67
70
        old_name1_value = factory.getRandomString()
68
71
        obj = FieldChangeTestModel(name1=old_name1_value)
74
77
    def test_connect_to_field_change_ignores_changes_to_other_fields(self):
75
78
        obj = FieldChangeTestModel(name2=factory.getRandomString())
76
79
        obj.save()
77
 
        callback = FakeMethod()
 
80
        callback = Mock()
78
81
        connect_to_field_change(callback, FieldChangeTestModel, 'name1')
79
82
        obj.name2 = factory.getRandomString()
80
83
        obj.save()
81
84
        self.assertEqual(0, callback.call_count)
82
85
 
83
86
    def test_connect_to_field_change_ignores_object_creation(self):
84
 
        callback = FakeMethod()
 
87
        callback = Mock()
85
88
        connect_to_field_change(callback, FieldChangeTestModel, 'name1')
86
89
        obj = FieldChangeTestModel(name1=factory.getRandomString())
87
90
        obj.save()
88
91
        self.assertEqual(0, callback.call_count)
 
92
 
 
93
    def test_connect_to_field_change_ignores_deletion_by_default(self):
 
94
        obj = FieldChangeTestModel(name2=factory.getRandomString())
 
95
        obj.save()
 
96
        callback = Mock()
 
97
        connect_to_field_change(callback, FieldChangeTestModel, 'name1')
 
98
        obj.delete()
 
99
        self.assertEqual(0, callback.call_count)
 
100
 
 
101
    def test_connect_to_field_change_listens_to_deletion_if_delete_True(self):
 
102
        old_name1_value = factory.getRandomString()
 
103
        obj = FieldChangeTestModel(name1=old_name1_value)
 
104
        obj.save()
 
105
        callback = Mock()
 
106
        connect_to_field_change(
 
107
            callback, FieldChangeTestModel, 'name1', delete=True)
 
108
        obj.delete()
 
109
        self.assertEqual(
 
110
            (1, call(obj, old_name1_value, deleted=True)),
 
111
            (callback.call_count, callback.call_args))