Esempio n. 1
0
def test_experiment_client_update_name_conflict(mocker):
    error_code = "experiment_name_conflict"
    exception = Conflict(mocker.Mock(), mocker.Mock(), error_code)
    mocker.patch.object(ExperimentClient, "_patch_raw", side_effect=exception)

    client = ExperimentClient(mocker.Mock())
    with pytest.raises(
        ExperimentNameConflict, match="name 'new name' already exists"
    ):
        client.update(PROJECT_ID, EXPERIMENT_ID, name="new name")
Esempio n. 2
0
def test_experiment_client_update(mocker, name, description):
    mocker.patch.object(ExperimentClient, "_patch_raw")

    client = ExperimentClient(mocker.Mock())
    client.update(
        PROJECT_ID, EXPERIMENT_ID, name=name, description=description
    )

    ExperimentClient._patch_raw.assert_called_once_with(
        "/project/{}/experiment/{}".format(PROJECT_ID, EXPERIMENT_ID),
        json={"name": name, "description": description},
    )