~dpb/charms/trusty/haproxy/merge-services-fix

« back to all changes in this revision

Viewing changes to hooks/tests/test_config_changed_hooks.py

  • Committer: Christopher Glass
  • Date: 2015-04-14 16:50:37 UTC
  • mfrom: (89.1.7 advertise-public-ip)
  • Revision ID: christopher.glass@canonical.com-20150414165037-j88nmjsv8y51vtwk
Merge lp:~free.ekanayaka/charms/trusty/haproxy/advertise-public-ip [a=free.ekanayaka] [r=tribaal]

Add a reverseproxy-relation-joined hook that will expose the unit's public IP and public SSL certificate, in case related services need it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    def setUp(self):
15
15
        super(ConfigChangedTest, self).setUp()
16
16
        self.config_get = self.patch_hook("config_get")
 
17
        self.config_get().changed.return_value = False
17
18
        self.get_service_ports = self.patch_hook("get_service_ports")
18
19
        self.get_listen_stanzas = self.patch_hook("get_listen_stanzas")
19
20
        self.create_haproxy_globals = self.patch_hook(
83
84
            "HAProxy configuration check failed, exiting.")
84
85
        self.sys_exit.assert_called_once_with(1)
85
86
 
 
87
    def test_config_changed_notify_reverseproxy(self):
 
88
        """
 
89
        If the ssl_cert config value changes, the reverseproxy relations get
 
90
        updated.
 
91
        """
 
92
        config_data = self.config_get()
 
93
        config_data.changed.return_value = True
 
94
        _notify_reverseproxy = self.patch_hook("_notify_reverseproxy")
 
95
 
 
96
        hooks.config_changed()
 
97
        config_data.changed.assert_called_once_with("ssl_cert")
 
98
        _notify_reverseproxy.assert_called_once()
 
99
 
86
100
 
87
101
class HelpersTest(TestCase):
88
102
    def test_constructs_haproxy_config(self):