diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-04-10 17:40:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-19 12:51:01 -0700 |
commit | c5eb806adb345e24b13ac4bf106cceb1dc9d3431 (patch) | |
tree | a071c9dede0640e23dd8032e6b1d0863d85b983e /tests | |
parent | da6395a4a8b68978caf47f98b48a82fabbe1dd20 (diff) | |
download | subsurface-c5eb806adb345e24b13ac4bf106cceb1dc9d3431.tar.gz |
cloudstorage: some cleanup of cloud url handling
We know the preference is never empty, so stop testing for this. But
don't maintain two different preferences with basically the same
content. Instead add the '/git' suffix where needed and keep this all in
one place.
Simplify the extraction of the branch name from the cloud URL.
Also a typo fix and a new comment.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testgitstorage.cpp | 3 | ||||
-rw-r--r-- | tests/testqPrefCloudStorage.cpp | 13 | ||||
-rw-r--r-- | tests/tst_qPrefCloudStorage.qml | 3 |
3 files changed, 1 insertions, 18 deletions
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp index f916b4e40..95ad3c308 100644 --- a/tests/testgitstorage.cpp +++ b/tests/testgitstorage.cpp @@ -111,14 +111,13 @@ void TestGitStorage::initTestCase() if (gitUrl.right(1) != "/") gitUrl += "/"; gitUrl += "git"; - prefs.cloud_git_url = copy_qstring(gitUrl); prefs.cloud_storage_email_encoded = copy_qstring(email); prefs.cloud_storage_password = copy_qstring(password); gitUrl += "/" + email; // all user storage for historical reasons always uses the user's email both as // repo name and as branch. To allow us to keep testing and not step on parallel // runs we'll use actually random branch names - yes, this still has a chance of - // conflict, but I'm not going to implement a distributed locak manager for this + // conflict, but I'm not going to implement a distributed lock manager for this if (email.startsWith("gitstorage")) { #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) randomBranch = QString::number(QRandomGenerator::global()->bounded(0x1000000), 16) + diff --git a/tests/testqPrefCloudStorage.cpp b/tests/testqPrefCloudStorage.cpp index 9d55ca743..a4e58ed82 100644 --- a/tests/testqPrefCloudStorage.cpp +++ b/tests/testqPrefCloudStorage.cpp @@ -23,7 +23,6 @@ void TestQPrefCloudStorage::test_struct_get() prefs.cloud_auto_sync = true; prefs.cloud_base_url = copy_qstring("new url"); - prefs.cloud_git_url = copy_qstring("new again url"); prefs.cloud_storage_email = copy_qstring("myEmail"); prefs.cloud_storage_email_encoded = copy_qstring("encodedMyEMail"); prefs.cloud_storage_password = copy_qstring("more secret"); @@ -34,7 +33,6 @@ void TestQPrefCloudStorage::test_struct_get() QCOMPARE(tst->cloud_auto_sync(), prefs.cloud_auto_sync); QCOMPARE(tst->cloud_base_url(), QString(prefs.cloud_base_url)); - QCOMPARE(tst->cloud_git_url(), QString(prefs.cloud_git_url)); QCOMPARE(tst->cloud_storage_email(), QString(prefs.cloud_storage_email)); QCOMPARE(tst->cloud_storage_email_encoded(), QString(prefs.cloud_storage_email_encoded)); QCOMPARE(tst->cloud_storage_password(), QString(prefs.cloud_storage_password)); @@ -69,9 +67,6 @@ void TestQPrefCloudStorage::test_set_struct() QCOMPARE((int)prefs.cloud_timeout, 123); QCOMPARE((int)prefs.cloud_verification_status, (int)qPrefCloudStorage::CS_VERIFIED); QCOMPARE(prefs.save_password_local, false); - - // remark is set with set_base_url - QCOMPARE(QString(prefs.cloud_git_url), QString("t2 base/git")); } void TestQPrefCloudStorage::test_set_load_struct() @@ -92,7 +87,6 @@ void TestQPrefCloudStorage::test_set_load_struct() prefs.cloud_auto_sync = false; prefs.cloud_base_url = copy_qstring("error1"); - prefs.cloud_git_url = copy_qstring("error1"); prefs.cloud_storage_email = copy_qstring("error1"); prefs.cloud_storage_email_encoded = copy_qstring("error1"); prefs.cloud_storage_password = copy_qstring("error1"); @@ -111,9 +105,6 @@ void TestQPrefCloudStorage::test_set_load_struct() QCOMPARE((int)prefs.cloud_timeout, 321); QCOMPARE((int)prefs.cloud_verification_status, (int)qPrefCloudStorage::CS_NOCLOUD); QCOMPARE(prefs.save_password_local, true); - - // remark is set with set_base_url - QCOMPARE(QString(prefs.cloud_git_url), QString("t3 base/git")); } void TestQPrefCloudStorage::test_struct_disk() @@ -136,7 +127,6 @@ void TestQPrefCloudStorage::test_struct_disk() prefs.cloud_auto_sync = false; prefs.cloud_base_url = copy_qstring("error1"); - prefs.cloud_git_url = copy_qstring("error1"); prefs.cloud_storage_email = copy_qstring("error1"); prefs.cloud_storage_email_encoded = copy_qstring("error1"); prefs.cloud_storage_password = copy_qstring("error1"); @@ -156,9 +146,6 @@ void TestQPrefCloudStorage::test_struct_disk() QCOMPARE((int)prefs.cloud_timeout, 123); QCOMPARE((int)prefs.cloud_verification_status, (int)qPrefCloudStorage::CS_VERIFIED); QCOMPARE(prefs.save_password_local, true); - - // remark is set with set_base_url - QCOMPARE(QString(prefs.cloud_git_url), QString("t4 base/git")); } void TestQPrefCloudStorage::test_multiple() diff --git a/tests/tst_qPrefCloudStorage.qml b/tests/tst_qPrefCloudStorage.qml index 7bc137d20..682fe1669 100644 --- a/tests/tst_qPrefCloudStorage.qml +++ b/tests/tst_qPrefCloudStorage.qml @@ -11,9 +11,6 @@ TestCase { PrefCloudStorage.cloud_base_url = "my url" compare(PrefCloudStorage.cloud_base_url, "my url") - var x2 = PrefCloudStorage.cloud_git_url - compare(PrefCloudStorage.cloud_git_url, "my url/git") - var x3 = PrefCloudStorage.cloud_storage_email PrefCloudStorage.cloud_storage_email = "my email" compare(PrefCloudStorage.cloud_storage_email, "my email") |