Skip to content

Commit d8afa4f

Browse files
committed
Move all test related stuff to tests/
1 parent b95eb8e commit d8afa4f

File tree

3 files changed

+328
-0
lines changed

3 files changed

+328
-0
lines changed

tests/apt-offline-testcase.bat

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@echo pypt-offline Test Cases
2+
3+
python.exe apt-offline get C:\signature.uris --threads 5 -d C:\test
4+
rmdir /q /s C:\test
5+
ping -n 10 localhost 1>null
6+
7+
python.exe apt-offline get C:\signature.uris --threads 5 --bundle C:\apt-offline-bundle.zip
8+
rmdir /q /s C:\apt-offline-bundle.zip
9+
ping -n 10 localhost 1>null
10+
11+
python.exe apt-offline get C:\signature.uris --threads 5
12+
ping -n 10 localhost 1>null
13+
14+
python.exe apt-offline get C:\signature.uris --bundle C:\apt-offline-bundle.zip
15+
rmdir /q /s C:\apt-offline-bundle.zip
16+
ping -n 10 localhost 1>null
17+
18+
python.exe apt-offline get C:\signature.uris -d C:\test
19+
rmdir /q /s C:\test
20+
ping -n 10 localhost 1>null
21+
22+
python.exe apt-offline get C:\signature.uris --threads 5 --bug-reports --download C:\test
23+
rmdir /q /s C:\test
24+
ping -n 10 localhost 1>null

tests/apt-offline-tests.sh

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
#!/bin/sh
2+
3+
DISLIKED_PACKAGES="lxde icewm eclipse"
4+
RELEASE=`lsb_release -c -s`
5+
URI="/tmp/set-$PPID.uris"
6+
CACHE_DIR="/var/cache/apt/archives"
7+
DOWNLOAD_DIR="/tmp/apt-offline-tests-$PPID"
8+
BUNDLE_FILE="/tmp/apt-offline-tests-$PPID.zip"
9+
THREADS=5
10+
APT_OFFLINE="./apt-offline "
11+
12+
set_features () {
13+
if [ ! -z $1 ]; then
14+
URI=$1
15+
fi
16+
echo "Executing command 'set $URI'"
17+
$APT_OFFLINE set $URI
18+
19+
echo "Executing command 'set $URI --simulate '"
20+
$APT_OFFLINE set $URI --simulate
21+
22+
echo "Executing command 'set $URI --update'"
23+
$APT_OFFLINE set $URI --update
24+
25+
echo "Executing command 'set $URI --upgrade'"
26+
$APT_OFFLINE set $URI --upgrade
27+
28+
echo "Executing command 'set $URI --update --upgrade'"
29+
$APT_OFFLINE set $URI --update --upgrade
30+
31+
echo "Executing command 'set $URI --update --upgrade --upgrade-type upgrade'"
32+
$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade
33+
34+
echo "Executing command 'set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE'"
35+
$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE
36+
37+
echo "Executing command 'set $URI --install-packages $DISLIKED_PACKAGES'"
38+
$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES
39+
40+
echo "Executing command 'set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE'"
41+
$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE
42+
43+
echo "Executing command 'set $URI --install-src-packages $DISLIKED_PACKAGES'"
44+
$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES
45+
46+
echo "Executing command 'set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE'"
47+
$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE
48+
49+
echo "Executing command 'set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES'"
50+
$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES
51+
52+
echo "Executing command 'set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE'"
53+
$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE
54+
55+
}
56+
57+
get_features () {
58+
if [ ! -z $1 ]; then
59+
URI=$1
60+
fi
61+
echo "Executing command 'get $URI '"
62+
$APT_OFFLINE get $URI
63+
64+
echo "Executing command 'get $URI --threads $THREADS'"
65+
$APT_OFFLINE get $URI --threads $THREADS
66+
67+
echo "Executing command 'get $URI --threads $THREADS --socket-timeout 30'"
68+
$APT_OFFLINE get $URI --threads $THREADS --socket-timeout 30
69+
70+
echo "Executing command 'get $URI --threads $THREADS -d $DOWNLOAD_DIR'"
71+
$APT_OFFLINE get $URI --threads $THREADS -d $DOWNLOAD_DIR
72+
73+
echo "Executing command 'get $URI --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
74+
$APT_OFFLINE get $URI --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
75+
76+
echo "Executing command 'get $URI --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
77+
$APT_OFFLINE get $URI --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
78+
79+
echo "Executing command 'get $URI --bug-reports --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
80+
$APT_OFFLINE get $URI --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
81+
82+
echo "Executing command 'get $URI --bug-reports --threads $THREADS --bundle $BUNDLE_FILE -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
83+
$APT_OFFLINE get $URI --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR --bundle $BUNDLE_FILE
84+
85+
}
86+
87+
install_features () {
88+
if [ ! -z $1 ]; then
89+
DOWNLOAD_DIR=$1
90+
BUNDLE_FILE=$1
91+
fi
92+
echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports'"
93+
$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports
94+
95+
echo "Executing command 'install $DOWNLOAD_DIR --simulate --skip-bug-reports'"
96+
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports
97+
98+
echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports'"
99+
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports
100+
101+
echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports --allow-unauthenticated'"
102+
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports --allow-unauthenticated
103+
104+
echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports'"
105+
$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports
106+
107+
echo "Executing command 'install $BUNDLE_FILE --simulate --skip-bug-reports'"
108+
$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports
109+
110+
echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports'"
111+
$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports
112+
113+
echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports --allow-unauthenticated'"
114+
$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports --allow-unauthenticated
115+
}
116+
117+
install_features_prompt () {
118+
if [ ! -z $1 ]; then
119+
DOWNLOAD_DIR=$1
120+
BUNDLE_FILE=$1
121+
fi
122+
echo "Executing command 'install $DOWNLOAD_DIR '"
123+
$APT_OFFLINE install $DOWNLOAD_DIR
124+
125+
echo "Executing command 'install $DOWNLOAD_DIR --simulate'"
126+
$APT_OFFLINE install $DOWNLOAD_DIR --simulate
127+
128+
echo "Executing command 'install $DOWNLOAD_DIR'"
129+
$APT_OFFLINE install $DOWNLOAD_DIR --simulate
130+
131+
echo "Executing command 'install $DOWNLOAD_DIR --allow-unauthenticated'"
132+
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --allow-unauthenticated
133+
134+
echo "Executing command 'install $BUNDLE_FILE '"
135+
$APT_OFFLINE install $BUNDLE_FILE
136+
137+
echo "Executing command 'install $BUNDLE_FILE --simulate'"
138+
$APT_OFFLINE install $BUNDLE_FILE --simulate
139+
140+
echo "Executing command 'install $BUNDLE_FILE'"
141+
$APT_OFFLINE install $BUNDLE_FILE --simulate
142+
143+
echo "Executing command 'install $BUNDLE_FILE --allow-unauthenticated'"
144+
$APT_OFFLINE install $BUNDLE_FILE --simulate --allow-unauthenticated
145+
}
146+
147+
all_features () {
148+
echo "Executing function set_features"
149+
set_features
150+
151+
echo "Executing function get_features"
152+
get_features
153+
154+
echo "Executing function install_features"
155+
install_features
156+
}
157+
158+
case $1 in
159+
"set")
160+
if [ ! -z $2 ]; then
161+
set_features $2
162+
else
163+
set_features
164+
fi
165+
;;
166+
"get")
167+
if [ ! -z $2 ]; then
168+
get_features $2
169+
else
170+
get_features
171+
fi
172+
;;
173+
"install_features_promptless")
174+
if [ ! -z $2 ]; then
175+
install_features $2
176+
else
177+
install_features
178+
fi
179+
;;
180+
"install")
181+
# With prompts for bug reports
182+
if [ ! -z $2 ]; then
183+
install_features_prompt $2
184+
else
185+
install_features_prompt
186+
fi
187+
;;
188+
"--help")
189+
echo "$0 [set || get || install_features_promptless || install]"
190+
exit 0;
191+
;;
192+
"-h")
193+
echo "$0 [set || get || install_features_promptless || install]"
194+
exit 0;
195+
;;
196+
*)
197+
all_features
198+
;;
199+
esac
200+

0 commit comments

Comments
 (0)