File indexing completed on 2024-04-21 04:57:46

0001 #!/bin/bash
0002 #
0003 # SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org>
0004 #
0005 # SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 
0007 set -e
0008 
0009 # enter a valid localhost login here
0010 host=$1
0011 if [ "$host" = "" ]; then
0012     echo "Need to pass base uri as argument... e.g. smb://foo/srv"
0013     exit 1
0014 fi
0015 dir='kio_smoke_test'
0016 uri="$host/$dir"
0017 
0018 kioclient5 remove $uri || true
0019 kioclient5 copy $dir $uri
0020 
0021 # upload
0022 kioclient5 copy file1 $uri/file1
0023 if [ "$(kioclient5 cat $uri/file1)" != "content1" ]; then
0024     echo "Reading file1 failed!"
0025     exit 1
0026 fi
0027 
0028 # remote rename
0029 kioclient5 move $uri/file1 $uri/file2
0030 if [ "$(kioclient5 cat $uri/file2)" != "content1" ]; then
0031     echo "Moving to file2 failed!"
0032     exit 1
0033 fi
0034 
0035 if kioclient5 cat $uri/file1; then
0036     echo "Tried to move file1 to file2 but now both exist!"
0037     exit 1
0038 fi
0039 
0040 # remote copy
0041 kioclient5 copy $uri/file2 $uri/file1
0042 
0043 # both exist
0044 kioclient5 cat $uri/file1
0045 kioclient5 cat $uri/file2
0046 
0047 # remote remove
0048 kioclient5 remove $uri/file1
0049 if kioclient5 cat $uri/file1; then
0050     echo "Tried to remove file1 but still exists!"
0051     exit 1
0052 fi
0053 
0054 # ls
0055 kioclient5 ls $uri # not checking output, too lazy
0056 
0057 # download
0058 rm -rfv file2
0059 kioclient5 copy $uri/file2 file://`pwd`/file2 # download
0060 if [ ! -e file2 ]; then
0061     echo "failed to download :("
0062     exit 1
0063 fi
0064 rm -rfv file2
0065 
0066 # delete remote dir again
0067 kioclient5 remove $uri