Skip to content

Commit

Permalink
Reuse UserOption when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
vheon committed Jan 10, 2016
1 parent 29a3c16 commit c6d2617
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
28 changes: 14 additions & 14 deletions ycmd/tests/get_completions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,21 @@ def UltiSnipsCompleter_Works_test( self ):


def UltiSnipsCompleter_UnusedWhenOffWithOption_test( self ):
self._ChangeSpecificOptions( { 'use_ultisnips_completer': False } )
self._app = TestApp( handlers.app )
with self.UserOption( 'use_ultisnips_completer', False ):
self._app = TestApp( handlers.app )

event_data = self._BuildRequest(
event_name = 'BufferVisit',
ultisnips_snippets = [
{'trigger': 'foo', 'description': 'bar'},
{'trigger': 'zoo', 'description': 'goo'},
] )
event_data = self._BuildRequest(
event_name = 'BufferVisit',
ultisnips_snippets = [
{'trigger': 'foo', 'description': 'bar'},
{'trigger': 'zoo', 'description': 'goo'},
] )

self._app.post_json( '/event_notification', event_data )
self._app.post_json( '/event_notification', event_data )

completion_data = self._BuildRequest( contents = 'oo ',
column_num = 3 )
completion_data = self._BuildRequest( contents = 'oo ',
column_num = 3 )

eq_( [],
self._app.post_json( '/completions',
completion_data ).json[ 'completions' ] )
eq_( [],
self._app.post_json( '/completions',
completion_data ).json[ 'completions' ] )
7 changes: 0 additions & 7 deletions ycmd/tests/handlers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ def _CompletionLocationMatcher( location_type, value ):
has_entry( location_type, value ) ) )


@staticmethod
def _ChangeSpecificOptions( options ):
current_options = dict( user_options_store.GetAll() )
current_options.update( options )
handlers.UpdateUserOptions( current_options )


@staticmethod
def _ErrorMatcher( cls, msg = None ):
""" Returns a hamcrest matcher for a server exception response """
Expand Down

0 comments on commit c6d2617

Please sign in to comment.