From e217ac8a5fa672b8615259ad54eb484923fa4e8a Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Thu, 5 Aug 2021 08:30:54 +0200 Subject: [PATCH] FIX: Move tests with server interaction to the integration tests. Only local testing remains in this repository. --- src/private/maox_caosdb.cpp | 2 +- test/Run_Test.m | 2 +- test/{test_caosdb.m => test_unittest.m} | 21 +++++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) rename test/{test_caosdb.m => test_unittest.m} (63%) diff --git a/src/private/maox_caosdb.cpp b/src/private/maox_caosdb.cpp index c706ed8..53fcf74 100644 --- a/src/private/maox_caosdb.cpp +++ b/src/private/maox_caosdb.cpp @@ -15,7 +15,7 @@ void print_usage() { mexPrintf("\nUsage: caosdb [OPTIONS]\n\n"); mexPrintf("Options:\n"); mexPrintf(" --help Print this help and return.\n"); - mexPrintf(" --version Print the version of OcataveCaosDB and " + mexPrintf(" --version Print the version of OctaveCaosDB and " "libcaosdb and return.\n"); mexPrintf( " --test-connection Test the default connection and return.\n"); diff --git a/test/Run_Test.m b/test/Run_Test.m index 374da3c..067c7d4 100644 --- a/test/Run_Test.m +++ b/test/Run_Test.m @@ -17,4 +17,4 @@ % along with this program. If not, see <https://www.gnu.org/licenses/>. pkg load caosdb; -moxunit_runtests -verbose test_caosdb.m; +moxunit_runtests -verbose test_unittest.m; diff --git a/test/test_caosdb.m b/test/test_unittest.m similarity index 63% rename from test/test_caosdb.m rename to test/test_unittest.m index 057b5c1..d8d9de1 100644 --- a/test/test_caosdb.m +++ b/test/test_unittest.m @@ -1,7 +1,7 @@ % This file is a part of the CaosDB Project. % % Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> -% Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> +% Copyright (C) 2021 Daniel Hornung <d.hornung@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 @@ -16,15 +16,24 @@ % 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/>. -function test_suite = test_caosdb +function test_suite=test_unittest() try % assignment of 'localfunctions' is necessary in Matlab >= 2016 - test_functions = localfunctions(); + test_functions=localfunctions(); catch % no problem; early Matlab versions can use initTestSuite fine end initTestSuite; end -function test_print_version - v = caosdb_exec("--version"); - assertEqual(v, "v0.1 (libcaosdb v0.0.6)"); +% Only tests which don't need a connection to a server. +function test_local() + % default connection + c1 = Caosdb(); + assertEqual(c1.connection, "") + % class with explicit connection + c2 = Caosdb(connection = "local-caosdb-admin"); + assertEqual(c2.connection, "local-caosdb-admin"); + + % Only get the local versions. + version = caosdb_exec("--version"); + assertEqual(version, "v0.1 (libcaosdb v0.0.6)"); end -- GitLab