def test_should_add_fail_information_to_failed_host_queue(self):

        mock_build_host_thread = Mock(BuildHostThread)
        mock_build_host_thread.failed_host_queue = Mock()
        mock_host_queue = Mock()
        mock_build_host_thread.host_queue = mock_host_queue

        BuildHostThread._notify_that_host_failed(mock_build_host_thread, 'devabc123', 'Stacktrace')

        mock_build_host_thread.failed_host_queue.put.assert_called_with(('devabc123', 'Stacktrace'))
    def test_should_clear_hosts_queue_when_maximum_of_failed_hosts_reached(self, mock_config):

        mock_config.return_value = 3
        mock_build_host_thread = Mock(BuildHostThread)
        fake_queue = Queue()
        fake_queue.put(('hostname1', 'stacktrace1'))
        fake_queue.put(('hostname2', 'stacktrace2'))
        mock_build_host_thread.failed_host_queue = fake_queue
        mock_build_host_thread.host_queue = Mock()

        BuildHostThread._notify_that_host_failed(mock_build_host_thread, 'devabc123', 'Stacktrace')

        mock_build_host_thread.host_queue.queue.clear.assert_called_with()
        mock_config.assert_called_with()