示例#1
0
 def test_connection_info_without_install(self):
     with pytest.raises(
             StateCheckError,
             message=
             'Executing connection_info action without install should raise an error'
     ):
         ns = Namespace(name='namespace', data=self.valid_data)
         ns.connection_info()
示例#2
0
 def test_connection_info(self):
     ns = Namespace(name='namespace', data=self.valid_data)
     ns.state.set('actions', 'install', 'ok')
     ns.state.set('status', 'running', 'ok')
     ns.api = MagicMock()
     result = {'ip': '127.0.0.1', 'port': 9900}
     task = task_mock(result)
     ns._zerodb.schedule_action = MagicMock(return_value=task)
     assert ns.connection_info() == result
     ns._zerodb.schedule_action.assert_called_once_with('connection_info')