Skip to content

Commit

Permalink
Use lowercase resource and owner names when storing assets on disk (#130
Browse files Browse the repository at this point in the history
)

* Use lowercase resource and owner names when storing assets on disk

Signed-off-by: Nate Koenig <[email protected]>

* Remove added diff text from merge

Signed-off-by: John Shepherd <[email protected]>

* change model version in test back

Signed-off-by: John Shepherd <[email protected]>

* Fix test

Signed-off-by: Nate Koenig <[email protected]>

* Fix windows

Signed-off-by: Nate Koenig <[email protected]>

* Fix more windows tests

Signed-off-by: Nate Koenig <[email protected]>

* Testing another windows fix

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: John Shepherd <[email protected]>
  • Loading branch information
3 people authored Nov 30, 2020
1 parent d82571c commit 4f7f5b6
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 117 deletions.
2 changes: 1 addition & 1 deletion src/ClientConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ std::string homePath()
#ifndef _WIN32
ignition::common::env("HOME", homePath);
#else
ignition::common::env("HOMEPATH", homePath);
ignition::common::env("USERPROFILE", homePath);
#endif

return homePath;
Expand Down
2 changes: 1 addition & 1 deletion src/CollectionIdentifier_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ TEST(CollectionIdentifier, AsString)
std::string str =
"Name: \n"\
"Owner: \n"\
"Unique name: https://fuel.ignitionrobotics.org\\\\collections\\\n"
"Unique name: https://fuel.ignitionrobotics.org\\collections\n"
"Server:\n"
" URL: https://fuel.ignitionrobotics.org\n"
" Version: 1.0\n"
Expand Down
72 changes: 36 additions & 36 deletions src/FuelClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ TEST_F(FuelClientTest, ParseModelURL)
EXPECT_EQ(id.Server().Url().Str(), "https://some.example.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 0u);
}

Expand All @@ -166,7 +166,7 @@ TEST_F(FuelClientTest, ParseModelURL)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 4u);
}

Expand All @@ -185,7 +185,7 @@ TEST_F(FuelClientTest, ParseModelURL)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 6u);
}

Expand All @@ -202,7 +202,7 @@ TEST_F(FuelClientTest, ParseModelURL)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_FALSE(id.Server().Version().empty());
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 0u);
}

Expand All @@ -221,7 +221,7 @@ TEST_F(FuelClientTest, ParseModelURL)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 0u);
}

Expand Down Expand Up @@ -292,8 +292,8 @@ TEST_F(FuelClientTest, ParseModelFileURL)

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Cordless Drill");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "cordless drill");
EXPECT_EQ(filePath, "meshes/cordless_drill.dae");
}

Expand All @@ -305,14 +305,14 @@ TEST_F(FuelClientTest, ParseModelFileURL)
ModelIdentifier id;
std::string filePath;
const common::URI modelUrl{
"https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Pine Tree/tip/"
"https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Pine Tree/tip/"
"files/materials/scripts/pine_tree.material"};
EXPECT_TRUE(client.ParseModelFileUrl(modelUrl, id, filePath));

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Pine Tree");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "pine tree");
EXPECT_EQ(filePath, "materials/scripts/pine_tree.material");
}

Expand All @@ -330,8 +330,8 @@ TEST_F(FuelClientTest, ParseModelFileURL)

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Pine Tree");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "pine tree");
EXPECT_EQ(filePath, "model.sdf");
}

Expand All @@ -341,15 +341,15 @@ TEST_F(FuelClientTest, ParseModelFileURL)
ModelIdentifier id;
std::string filePath;
const common::URI modelUrl{
"https://fuel.ignitionrobotics.org/OpenRobotics/models/Pine Tree/tip/"
"https://fuel.ignitionrobotics.org/OpenRobotics/models/pine tree/tip/"
"files/materials/scripts/pine_tree.material"};
EXPECT_TRUE(client.ParseModelFileUrl(modelUrl, id, filePath));

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_FALSE(id.Server().Version().empty());
EXPECT_EQ("1.0", id.Server().Version());
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Pine Tree");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "pine tree");
EXPECT_EQ(filePath, "materials/scripts/pine_tree.material");
}

Expand All @@ -361,14 +361,14 @@ TEST_F(FuelClientTest, ParseModelFileURL)
ModelIdentifier id;
std::string filePath;
const common::URI modelUrl{
"https://fuel.ignitionrobotics.org/OpenRobotics/models/Pine Tree/tip/"
"https://fuel.ignitionrobotics.org/openrobotics/models/Pine Tree/tip/"
"files/materials/scripts/pine_tree.material"};
EXPECT_TRUE(client.ParseModelFileUrl(modelUrl, id, filePath));

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Pine Tree");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "pine tree");
EXPECT_EQ(filePath, "materials/scripts/pine_tree.material");
}

Expand Down Expand Up @@ -427,7 +427,7 @@ TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadModel))

// Check it was downloaded to `2`
auto modelPath = common::joinPaths(common::cwd(), "test_cache",
"fuel.ignitionrobotics.org", "chapulina", "models", "Test box");
"fuel.ignitionrobotics.org", "chapulina", "models", "test box");

EXPECT_EQ(path, common::joinPaths(modelPath, "2"));
EXPECT_TRUE(common::exists(common::joinPaths(modelPath, "2")));
Expand Down Expand Up @@ -465,7 +465,7 @@ TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadModel))

// Check it was downloaded to `2`
auto modelPath = common::joinPaths(common::cwd(), "test_cache",
"fuel.ignitionrobotics.org", "iche033", "models", "Rescue Randy");
"fuel.ignitionrobotics.org", "iche033", "models", "rescue randy");

EXPECT_EQ(path, common::joinPaths(modelPath, "2"));
EXPECT_TRUE(common::exists(common::joinPaths(modelPath, "2")));
Expand Down Expand Up @@ -668,7 +668,7 @@ TEST_F(FuelClientTest, ParseWorldUrl)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 0u);
}

Expand All @@ -687,7 +687,7 @@ TEST_F(FuelClientTest, ParseWorldUrl)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 4u);
}

Expand All @@ -706,7 +706,7 @@ TEST_F(FuelClientTest, ParseWorldUrl)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 6u);
}

Expand All @@ -724,7 +724,7 @@ TEST_F(FuelClientTest, ParseWorldUrl)
EXPECT_FALSE(id.Server().Version().empty());
EXPECT_EQ("1.0", id.Server().Version());
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 0u);
}

Expand All @@ -743,7 +743,7 @@ TEST_F(FuelClientTest, ParseWorldUrl)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "german");
EXPECT_EQ(id.Name(), "Cardboard Box");
EXPECT_EQ(id.Name(), "cardboard box");
EXPECT_EQ(id.Version(), 0u);
}

Expand Down Expand Up @@ -811,8 +811,8 @@ TEST_F(FuelClientTest, ParseWorldFileUrl)

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Empty");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "empty");
EXPECT_EQ(filePath, "test.world");
}

Expand All @@ -830,8 +830,8 @@ TEST_F(FuelClientTest, ParseWorldFileUrl)

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Empty sky");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "empty sky");
EXPECT_EQ(filePath, "empty_sky.world");
}

Expand All @@ -849,8 +849,8 @@ TEST_F(FuelClientTest, ParseWorldFileUrl)

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Empty");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "empty");
EXPECT_EQ(filePath, "test.world");
}

Expand All @@ -867,8 +867,8 @@ TEST_F(FuelClientTest, ParseWorldFileUrl)
EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_FALSE(id.Server().Version().empty());
EXPECT_EQ("1.0", id.Server().Version());
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Empty sky");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "empty sky");
EXPECT_EQ(filePath, "empty_sky.world");
}

Expand All @@ -886,8 +886,8 @@ TEST_F(FuelClientTest, ParseWorldFileUrl)

EXPECT_EQ(id.Server().Url().Str(), "https://fuel.ignitionrobotics.org");
EXPECT_EQ(id.Server().Version(), "1.0");
EXPECT_EQ(id.Owner(), "OpenRobotics");
EXPECT_EQ(id.Name(), "Empty");
EXPECT_EQ(id.Owner(), "openrobotics");
EXPECT_EQ(id.Name(), "empty");
EXPECT_EQ(filePath, "test.world");
}

Expand Down Expand Up @@ -952,7 +952,7 @@ TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadWorld))

// Check it was downloaded to `1`
auto worldPath = common::joinPaths(common::cwd(), "test_cache",
"fuel.ignitionrobotics.org", "OpenRobotics", "worlds", "Test world");
"fuel.ignitionrobotics.org", "openrobotics", "worlds", "test world");

EXPECT_EQ(path, common::joinPaths(worldPath, "2"));
EXPECT_TRUE(common::exists(common::joinPaths(worldPath, "2")));
Expand Down
Loading

0 comments on commit 4f7f5b6

Please sign in to comment.