You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
""" Allow the test suite to control a remote webapp server. """
|
|
|
|
import grpc
|
|
from google.protobuf.empty_pb2 import Empty
|
|
|
|
from asl_rulebook2.webapp.tests.proto.generated.control_tests_pb2_grpc import ControlTestsStub
|
|
|
|
from asl_rulebook2.webapp.tests.proto.generated.control_tests_pb2 import \
|
|
SetDataDirRequest
|
|
|
|
# ---------------------------------------------------------------------
|
|
|
|
# NOTE: The API for this class should be kept in sync with ControlTestsServicer.
|
|
|
|
class ControlTests:
|
|
"""Control a remote webapp server."""
|
|
|
|
def __init__( self, addr ):
|
|
# initialize
|
|
channel = grpc.insecure_channel( addr )
|
|
self._stub = ControlTestsStub( channel )
|
|
|
|
def start_tests( self ):
|
|
"""Start a new test run."""
|
|
self._stub.startTests( Empty() )
|
|
return self
|
|
|
|
def end_tests( self ):
|
|
"""End a test run."""
|
|
self._stub.endTests( Empty() )
|
|
|
|
def set_data_dir( self, fixtures_dname ):
|
|
"""Set the data directory."""
|
|
self._stub.setDataDir(
|
|
SetDataDirRequest( fixturesDirName = fixtures_dname )
|
|
)
|
|
return self
|
|
|