2020#
2121############################################################################*/
2222
23- #include " stdafx.h"
2423#include " catch.hpp"
24+ #include " fixture.hpp"
25+
26+ #include < webdav/client.hpp>
2527
2628SCENARIO (" Client must clean an existing remote resources" , " [clean]" ) {
2729
30+ auto options = fixture::get_options ();
31+ auto content = fixture::get_buff_content ();
32+ auto dirname = fixture::get_dir_name ();
33+ auto filename = fixture::get_file_name ();
34+
35+ CAPTURE (dirname);
36+ CAPTURE (filename);
37+
2838 std::unique_ptr<WebDAV::Client> client (WebDAV::Client::Init (options));
2939
3040 GIVEN (" An existing remote resource" ) {
3141
32- std::string existing_file = " file.dat " ;
33- std::string existing_directory = " existing_directory/ " ;
42+ std::string existing_file = filename ;
43+ std::string existing_directory = dirname ;
3444
35- client->upload_from (existing_file, (char *)file_content .c_str (), file_content .length ());
45+ client->upload_from (existing_file, (char *)content .c_str (), content .length ());
3646 client->create_directory (existing_directory);
3747
3848 WHEN (" Clean an existing remote file" ) {
@@ -65,6 +75,8 @@ SCENARIO("Client must clean an existing remote resources", "[clean]") {
6575
6676SCENARIO (" Client must clean not an existing remote resources" , " [clean]" ) {
6777
78+ auto options = fixture::get_options ();
79+
6880 std::unique_ptr<WebDAV::Client> client (WebDAV::Client::Init (options));
6981
7082 GIVEN (" Not an existing remote resource" ) {
@@ -102,16 +114,22 @@ SCENARIO("Client must clean not an existing remote resources", "[clean]") {
102114
103115SCENARIO (" Client must clean not an empty remote directories" , " [clean]" ) {
104116
117+ auto options = fixture::get_options ();
118+ auto content = fixture::get_buff_content ();
119+ auto dirname = fixture::get_dir_name ();
120+
121+ CAPTURE (dirname);
122+
105123 std::unique_ptr<WebDAV::Client> client (WebDAV::Client::Init (options));
106124
107125 GIVEN (" Not an empty remote directory" ) {
108126
109- std::string not_empty_directory = " not_empty_directory/ " ;
110- std::string attached_file = " not_empty_directory/ attached_file.dat" ;
111- std::string attached_directory = " not_empty_directory/ attached_directory/" ;
127+ std::string not_empty_directory = dirname ;
128+ std::string attached_file = not_empty_directory + " / " + " attached_file.dat" ;
129+ std::string attached_directory = not_empty_directory + " / " + " attached_directory/" ;
112130
113131 client->create_directory (not_empty_directory);
114- client->upload_from (attached_file, (char *)file_content .c_str (), file_content .length ());
132+ client->upload_from (attached_file, (char *)content .c_str (), content .length ());
115133 client->create_directory (attached_directory);
116134
117135 WHEN (" Clean not an empty directory" ) {
@@ -136,11 +154,16 @@ SCENARIO("Client must clean not an empty remote directories", "[clean]") {
136154
137155SCENARIO (" Client must clean a remote directory" , " [clean]" ) {
138156
157+ auto options = fixture::get_options ();
158+ auto dirname = fixture::get_dir_name ();
159+
160+ CAPTURE (dirname);
161+
139162 std::unique_ptr<WebDAV::Client> client (WebDAV::Client::Init (options));
140163
141164 GIVEN (" An existing directory" ) {
142165
143- std::string directory_name = " directory " ;
166+ std::string directory_name = dirname ;
144167 client->create_directory (directory_name);
145168
146169 WHEN (" Clean directory by a name" ) {
@@ -155,4 +178,4 @@ SCENARIO("Client must clean a remote directory", "[clean]") {
155178 }
156179 }
157180 }
158- }
181+ }
0 commit comments