Skip to content
Snippets Groups Projects
Verified Commit df154b88 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: files

parent a4b298ac
No related branches found
No related tags found
1 merge request!8F files
Pipeline #11242 passed
[requires]
caosdb/0.0.9
caosdb/0.0.10
gtest/1.11.0
[generators]
......
......@@ -23,6 +23,7 @@
#######################################################################
set(test_cases
test_connection
test_file_transmission
test_transaction
test_ccaosdb
)
......
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
* Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "caosdb/connection.h" // for Connection, ConnectionManager
#include "caosdb/entity/v1alpha1/main.pb.h"
#include "caosdb/transaction.h" // for Entity, Transaction, UniqueRe...
#include "gtest/gtest-message.h" // for Message
#include "gtest/gtest-test-part.h" // for TestPartResult, SuiteApiResolver
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, AssertionResult
#include <memory> // for unique_ptr, allocator, __shar...
#include <string> // for string
namespace caosdb::transaction {
using caosdb::entity::v1alpha1::RegisterFileUploadResponse;
using caosdb::entity::v1alpha1::RegistrationStatus;
class test_file_transmission : public ::testing::Test {
protected:
void SetUp() override {}
void TearDown() override {
// TODO(tf): delete all created entities
}
};
TEST_F(test_file_transmission, register_file_upload) {
const auto &connection =
caosdb::connection::ConnectionManager::GetDefaultConnection();
auto transaction(connection->CreateTransaction());
RegisterFileUploadResponse response;
EXPECT_EQ(response.status(),
RegistrationStatus::REGISTRATION_STATUS_UNSPECIFIED);
transaction->RegisterUploadFile(&response);
EXPECT_EQ(response.status(),
RegistrationStatus::REGISTRATION_STATUS_ACCEPTED);
EXPECT_FALSE(response.registration_id().empty());
}
} // namespace caosdb::transaction
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment