Exemplo n.º 1
0
    def test_lucene_version(self):
        '''
        Test to get the lucene version that solr is using.
        '''
        with patch.object(solr, '_get_return_dict', return_value={'A': 'a'}):
            with patch.object(solr, '_get_none_or_value',
                              side_effect=[None, True, True]):
                with patch.object(solr, '_check_for_cores',
                                  side_effect=[True, False, False]):
                    tempdict = {'success': 'success', 'errors': 'errors',
                                'data': {'lucene': {'lucene-spec-version': 1}}}
                    with patch.object(solr, '_get_admin_info',
                                      side_effect=[tempdict, tempdict,
                                                   {'success': None}]):
                        with patch.dict(solr.__salt__,
                                        {'config.option':
                                         MagicMock(return_value=['A'])}):

                            with patch.object(solr, '_update_return_dict',
                                              return_value={'A': 'a'}):
                                self.assertDictEqual(solr.lucene_version('c'),
                                                     {'A': 'a'})

                            self.assertDictEqual(solr.lucene_version('c'),
                                                 {'A': 'a'})

                            self.assertDictEqual(solr.lucene_version('c'),
                                                 {'success': None})
Exemplo n.º 2
0
    def test_lucene_version(self):
        '''
        Test to get the lucene version that solr is using.
        '''
        with patch.object(solr, '_get_return_dict', return_value={'A': 'a'}):
            with patch.object(solr, '_get_none_or_value',
                              side_effect=[None, True, True]):
                with patch.object(solr, '_check_for_cores',
                                  side_effect=[True, False, False]):
                    tempdict = {'success': 'success', 'errors': 'errors',
                                'data': {'lucene': {'lucene-spec-version': 1}}}
                    with patch.object(solr, '_get_admin_info',
                                      side_effect=[tempdict, tempdict,
                                                   {'success': None}]):
                        with patch.dict(solr.__salt__,
                                        {'config.option':
                                         MagicMock(return_value=['A'])}):

                            with patch.object(solr, '_update_return_dict',
                                              return_value={'A': 'a'}):
                                self.assertDictEqual(solr.lucene_version('c'),
                                                     {'A': 'a'})

                            self.assertDictEqual(solr.lucene_version('c'),
                                                 {'A': 'a'})

                            self.assertDictEqual(solr.lucene_version('c'),
                                                 {'success': None})
Exemplo n.º 3
0
    def test_lucene_version(self):
        """
        Test to get the lucene version that solr is using.
        """
        with patch.object(solr, "_get_return_dict", return_value={"A": "a"}):
            with patch.object(solr,
                              "_get_none_or_value",
                              side_effect=[None, True, True]):
                with patch.object(solr,
                                  "_check_for_cores",
                                  side_effect=[True, False, False]):
                    tempdict = {
                        "success": "success",
                        "errors": "errors",
                        "data": {
                            "lucene": {
                                "lucene-spec-version": 1
                            }
                        },
                    }
                    with patch.object(
                            solr,
                            "_get_admin_info",
                            side_effect=[
                                tempdict, tempdict, {
                                    "success": None
                                }
                            ],
                    ):
                        with patch.dict(
                                solr.__salt__,
                            {"config.option": MagicMock(return_value=["A"])},
                        ):

                            with patch.object(solr,
                                              "_update_return_dict",
                                              return_value={"A": "a"}):
                                self.assertDictEqual(solr.lucene_version("c"),
                                                     {"A": "a"})

                            self.assertDictEqual(solr.lucene_version("c"),
                                                 {"A": "a"})

                            self.assertDictEqual(solr.lucene_version("c"),
                                                 {"success": None})