diff --git a/include/ignition/fuel_tools/FuelClient.hh b/include/ignition/fuel_tools/FuelClient.hh index b71aa769..4a007140 100644 --- a/include/ignition/fuel_tools/FuelClient.hh +++ b/include/ignition/fuel_tools/FuelClient.hh @@ -352,6 +352,9 @@ namespace ignition /// /// Model fields that are patched by this function: /// * private + /// * Model files contained in _pathToModelDir. + /// * Description, tags, license, and other attributes found in the + /// metadata.pbtxt or model.config file. /// /// \param[in] _model The model to patch. The contents of this model /// will be sent in the PATCH request. diff --git a/src/FuelClient_TEST.cc b/src/FuelClient_TEST.cc index 3d0242f8..7af1fe5c 100644 --- a/src/FuelClient_TEST.cc +++ b/src/FuelClient_TEST.cc @@ -1357,6 +1357,33 @@ TEST_F(FuelClientTest, UploadModelFail) EXPECT_EQ(ResultType::UPLOAD_ERROR, result.Type()); } +////////////////////////////////////////////////// +TEST_F(FuelClientTest, PatchModelFail) +{ + FuelClient client; + ModelIdentifier modelId; + + std::vector headers; + + // Bad directory + Result result = client.PatchModel(modelId, headers, "bad"); + EXPECT_EQ(ResultType::UPLOAD_ERROR, result.Type()); + + // Missing metadata.pbtxt and model.config + result = client.PatchModel(modelId, headers, common::cwd()); + EXPECT_EQ(ResultType::UPLOAD_ERROR, result.Type()); + + ClientConfig config; + config.SetCacheLocation(common::joinPaths(common::cwd(), "test_cache")); + createLocalModel(config); + + // Bad model.config + result = client.PatchModel(modelId, headers, + common::joinPaths(common::cwd(), "test_cache", "localhost:8007", + "alice", "models", "My Model", "3")); + EXPECT_EQ(ResultType::UPLOAD_ERROR, result.Type()); +} + ////////////////////////////////////////////////// int main(int argc, char **argv) { diff --git a/src/ign.hh b/src/ign.hh index 4cf74a47..a13d0866 100644 --- a/src/ign.hh +++ b/src/ign.hh @@ -118,6 +118,7 @@ extern "C" IGNITION_FUEL_TOOLS_VISIBLE int pbtxt2Config(const char *_path); /// \param[in] _header An HTTP header. /// \param[in] _private "1" to make the resource private, "0" to make it /// public +/// \param[in] _path Resource path. /// \return 1 if successful, 0 if not. extern "C" IGNITION_FUEL_TOOLS_VISIBLE int editUrl( const char *_url, const char *_header = nullptr,