~ballot/mojo/add_tests

« back to all changes in this revision

Viewing changes to mojo/tests/test_juju2.py

  • Committer: mergebot at canonical
  • Author(s): "Tom Haddon"
  • Date: 2020-06-09 07:50:38 UTC
  • mfrom: (552.1.1 lp-1882574)
  • Revision ID: mergebot@juju-139df4-prod-is-toolbox-0.canonical.com-20200609075038-cb9807vkfge3oetb
Clear _cached_status when doing a forced update of status



Reviewed-on: https://code.launchpad.net/~mthaddon/mojo/lp-1882574/+merge/385295
Reviewed-by: Stuart Bishop <stuart.bishop@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
235
235
            self.status.status()
236
236
            self.assertFalse(mock_check_output.called)
237
237
            # And now check if we pass the force_update option, that it is
238
 
            # called
 
238
            # called. Also check _cached_status is cleared, so subsequent
 
239
            # calls to yaml_status will get updated information.
 
240
            self.status._cached_status = "Something"
239
241
            self.status.status(force_update=True)
240
242
            mock_check_output.assert_called_with(
241
243
                ["/usr/bin/timeout", "--kill-after", "5", "600", JUJU_PATH, "status", "--format=yaml"],
242
244
                universal_newlines=True,
243
245
            )
 
246
            self.assertFalse(self.status._cached_status)
244
247
 
245
248
    @mock.patch("mojo.juju.status.check_output_with_timeout")
246
249
    def test_yaml_status(self, _check_output_with_timeout):