added check_version unit test
This commit is contained in:
62
repertory/repertory_test/src/fuse_drive_misc_test.cpp
Normal file
62
repertory/repertory_test/src/fuse_drive_misc_test.cpp
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
Copyright <2018-2025> <scott.e.graves@protonmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
|
#include "fixtures/drive_fixture.hpp"
|
||||||
|
|
||||||
|
#include "comm/packet/packet_client.hpp"
|
||||||
|
#include "utils/utils.hpp"
|
||||||
|
#include "version.hpp"
|
||||||
|
|
||||||
|
namespace repertory {
|
||||||
|
TYPED_TEST_SUITE(fuse_test, platform_provider_types);
|
||||||
|
|
||||||
|
TYPED_TEST(fuse_test, misc_can_check_remote_version) {
|
||||||
|
if (this->mount_provider != provider_type::remote) {
|
||||||
|
GTEST_SKIP();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet_client client(this->config->get_remote_config());
|
||||||
|
|
||||||
|
std::uint32_t min_version{};
|
||||||
|
auto client_version = utils::get_version_number(project_get_version());
|
||||||
|
auto res = client.check_version(client_version, min_version);
|
||||||
|
EXPECT_EQ(api_error::success, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
TYPED_TEST(fuse_test, misc_can_fail_invalid_remote_version) {
|
||||||
|
if (this->mount_provider != provider_type::remote) {
|
||||||
|
GTEST_SKIP();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet_client client(this->config->get_remote_config());
|
||||||
|
|
||||||
|
std::uint32_t min_version{};
|
||||||
|
auto client_version = utils::get_version_number("2.0.7-release");
|
||||||
|
auto res = client.check_version(client_version, min_version);
|
||||||
|
EXPECT_EQ(api_error::incompatible_version, res);
|
||||||
|
}
|
||||||
|
} // namespace repertory
|
||||||
|
|
||||||
|
#endif // !defined(_WIN32)
|
Reference in New Issue
Block a user