~juju/ubuntu/quantal/juju/0.6

« back to all changes in this revision

Viewing changes to juju/state/tests/test_hook.py

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-10-09 09:50:34 UTC
  • mto: (10.1.1 precise)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20111009095034-wqzww7z4tx2n0x43
Tags: upstream-0.5+bzr398
ImportĀ upstreamĀ versionĀ 0.5+bzr398

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
            self.wordpress_states, "modified", "mysql/0")
78
78
        yield context.set_value("hello", u"world")
79
79
        data = yield context.get("wordpress/0")
80
 
        self.assertEqual(data, {"hello": "world"})
 
80
        self.assertEqual(
 
81
            data,
 
82
            {"hello": "world", "private-address": "wordpress-0.example.com"})
81
83
        del data["hello"]
82
84
        current_data = yield context.get("wordpress/0")
83
85
        self.assertNotEqual(current_data, data)
158
160
        changes = yield context.flush()
159
161
        content, stat = yield self.client.get(
160
162
            self.get_unit_settings_path(self.wordpress_states))
 
163
        data["private-address"] = "wordpress-0.example.com"
161
164
        self.assertEqual(yaml.load(content), data)
162
165
        self.assertEqual(changes,
163
166
                         [AddedItem("abc", 12), AddedItem("bar", "21")])
172
175
        yield context.set_value("donkey", u"abc")
173
176
        data, stat = yield self.client.get(
174
177
            self.get_unit_settings_path(self.wordpress_states))
175
 
        self.assertFalse(data)
 
178
        self.assertEqual(yaml.load(data),
 
179
                         {"private-address": "wordpress-0.example.com"})
176
180
 
177
181
        changes = yield context.flush()
178
182
        data, stat = yield self.client.get(
180
184
 
181
185
        self.assertEqual(
182
186
            yaml.load(data),
183
 
            {"zebra": 12, "donkey": "abc"})
 
187
            {"zebra": 12, "donkey": "abc",
 
188
             "private-address": "wordpress-0.example.com"})
 
189
 
184
190
        self.assertEqual(
185
191
            changes,
186
192
            [AddedItem("donkey", u"abc"), AddedItem("zebra", 12)])
388
394
        unit = yield context.get_local_unit_state()
389
395
        self.assertEqual(unit.unit_name, "wordpress/0")
390
396
 
391
 
 
392
397
    @inlineCallbacks
393
398
    def test_config_get(self):
394
399
        """Verify we can get config settings.