Refactoring tests to use new helper methods

Plus minor formatting fixes.
This commit is contained in:
Strahinja Val Markovic 2014-05-09 12:06:56 -07:00
parent 72d91957fc
commit a4da9ee686
2 changed files with 12 additions and 9 deletions

View File

@ -63,6 +63,7 @@ class CsharpDiagnosticLocation:
self.column_number_ = column
self.filename_ = filename
class CsharpCompleter( Completer ):
"""
A Completer that uses the Omnisharp server as completion engine.

View File

@ -20,7 +20,8 @@
from ..server_utils import SetUpPythonPath
SetUpPythonPath()
import time
from .test_utils import Setup, BuildRequest, PathToTestFile
from .test_utils import ( Setup, BuildRequest, PathToTestFile,
StopOmniSharpServer )
from webtest import TestApp
from nose.tools import with_setup, eq_
from hamcrest import ( assert_that, contains, contains_string, has_entries,
@ -169,7 +170,8 @@ def Diagnostics_CsCompleter_ZeroBasedLineAndColumn_test():
assert_that( results,
contains(
has_entries( {
'text': contains_string( "Unexpected symbol `}'', expecting identifier" ),
'text': contains_string(
"Unexpected symbol `}'', expecting identifier" ),
'location': has_entries( {
'line_num': 9,
'column_num': 1
@ -186,6 +188,8 @@ def Diagnostics_CsCompleter_ZeroBasedLineAndColumn_test():
} )
} ) ) )
StopOmniSharpServer( app )
@with_setup( Setup )
def GetDetailedDiagnostic_ClangCompleter_Works_test():
@ -248,14 +252,12 @@ def GetDetailedDiagnostic_CsCompleter_Works_test():
results = app.post_json( '/detailed_diagnostic', diag_data ).json
assert_that( results,
has_entry( 'message', contains_string( "Unexpected symbol `}'', expecting identifier" ) ) )
has_entry(
'message',
contains_string(
"Unexpected symbol `}'', expecting identifier" ) ) )
# We need to turn off the CS server so that it doesn't stick around
app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['StopServer'],
filetype = 'cs' ) )
StopOmniSharpServer( app )
@with_setup( Setup )