def test_client_add_dataset(): client.requests = test_add # OMG more monkey patching ec = Client('localhost:6363') ec.add('iris', example('iris.csv')) assert 'iris' in ec.dshape.measure.dict iris_data = bz_data(example('iris.csv')) assert ec.dshape.measure.dict['iris'] == iris_data.dshape
def test_client_add_dataset_with_args(): client.requests = test_add # OMG more monkey patching ec = Client('localhost:6363') ec.add('teams', 'sqlite:///' + example('teams.db'), 'teams', primary_key='teamID') assert 'teams' in ec.dshape.measure.dict teams_data = bz_data('sqlite:///' + example('teams.db') + '::teams') assert ec.dshape.measure.dict['teams'] == teams_data.dshape
def test_client_add_dataset_failure(): client.requests = test_add # OMG more monkey patching ec = Client('localhost:6363') with pytest.raises(ValueError) as exc: ec.add('iris2', example('iris.csv'), -1, bad_arg='value') assert '422 UNPROCESSABLE ENTITY' in str(exc.value)
def test_client_cant_add_dataset(): ec = Client('localhost:6363') with pytest.raises(ValueError) as excinfo: ec.add('iris', example('iris.csv')) assert "Server does not support" in str(excinfo.value)