示例#1
0
    def todo_test_syntax_status(self, query_status):
        # TODO(rwill): this currently crashes because of build_*_dependency_tree.component_files
        # extract file I/O from status() method into submethods, so those can be mocked.
        protocol = Mock()
        protocol.component = "host://myhost"
        protocol.data = '''
fqdn: foobar42.acme.com
current_artefacts:
- foo/1.0
- bar/2.3
next_artefacts:
- foo/1.1
services:
  tomcat:
    needs_services: [database]
    state: down
  database:
    state: up
'''
        query_status.return_value = defer.succeed(protocol)
        yadtshell.status("myhost")
示例#2
0
    def test_should_setup_deferred_list_with_two_hosts(self, _, query_status, pi):
        yadtshell.status(hosts=['foobar42', 'foobar43'])

        self.assertEqual(query_status.call_args_list, [
            call('foobar42', pi.return_value),
            call('foobar43', pi.return_value)])
示例#3
0
    def test_should_remove_old_state_files_explicity_when_calling_status_with_hosts(self, os, glob):
        yadtshell.status(hosts=['foobar42'])

        os.path.join.assert_called_with(yadtshell.settings.OUT_DIR, 'current_state_foobar42.yaml')
        os.remove.assert_called_with(os.path.join.return_value)
示例#4
0
    def test_should_remove_globbed_old_state_files_when_calling_status_without_hosts(self, os, glob):
        yadtshell.status()

        os.path.join.assert_called_with(yadtshell.settings.OUT_DIR, 'current_state*')
        os.remove.assert_called_with(os.path.join.return_value)
    def test_should_setup_deferred_list_with_two_hosts(self, _, query_status, pi):
        yadtshell.status(hosts=['foobar42', 'foobar43'])

        self.assertEqual(query_status.call_args_list, [
            call('foobar42', {}, pi.return_value),
            call('foobar43', {}, pi.return_value)])
    def test_should_remove_old_state_files_explicity_when_calling_status_with_hosts(self, os, glob):
        yadtshell.status(hosts=['foobar42'])

        os.path.join.assert_called_with(yadtshell.settings.OUT_DIR, 'current_state_foobar42.yaml')
        os.remove.assert_called_with(os.path.join.return_value)