comparison dav.t @ 1360:6efe4dbf713b

Tests: added dav copy test with existing destination file.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 01 Aug 2018 13:35:15 +0300
parents ccf134a800ae
children 144c6ce732e4
comparison
equal deleted inserted replaced
1359:28ba4b465635 1360:6efe4dbf713b
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(18); 24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(20);
25 25
26 $t->write_file_expand('nginx.conf', <<'EOF'); 26 $t->write_file_expand('nginx.conf', <<'EOF');
27 27
28 %%TEST_GLOBALS%% 28 %%TEST_GLOBALS%%
29 29
147 147
148 like($r, qr/204 No Content/, 'copy file escaped'); 148 like($r, qr/204 No Content/, 'copy file escaped');
149 149
150 is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped'); 150 is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped');
151 151
152 $t->write_file('file.exist', join '', (1 .. 42));
153
154 $r = http(<<EOF);
155 COPY /file HTTP/1.1
156 Host: localhost
157 Destination: /file.exist
158 Connection: close
159
160 EOF
161
162 like($r, qr/204 No Content/, 'copy file overwrite');
163
164 TODO: {
165 local $TODO = 'not yet' unless $t->has_version('1.15.3');
166
167 is(-s $t->testdir() . '/file.exist', 10, 'target file truncated');
168
169 }
170
152 $r = http(<<EOF . '0123456789'); 171 $r = http(<<EOF . '0123456789');
153 PUT /i/alias HTTP/1.1 172 PUT /i/alias HTTP/1.1
154 Host: localhost 173 Host: localhost
155 Connection: close 174 Connection: close
156 Content-Length: 10 175 Content-Length: 10