8 #include <CUnit/CUnit.h>
9 #include "wget_agent.h"
11 #include "libfodbreposysconf.h"
28 static char TempFile[MAX_LENGTH];
29 static char URL[MAX_LENGTH];
30 static char TempFileDir[MAX_LENGTH];
44 if (file_dir_existed(TempFileDir))
67 strcpy(URL,
"https://mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/14.04/fossology.sources.list");
68 strcpy(TempFileDir,
"./test_result");
69 GetURL(TempFile, URL, TempFileDir);
70 int existed = file_dir_existed(
"./test_result/mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/14.04/fossology.sources.list");
71 CU_ASSERT_EQUAL(existed, 1);
89 strcpy(URL,
"https://mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/14.04/");
90 strcpy(TempFileDir,
"./test_result/");
91 strcpy(TempFile,
"./test_result/fossology.sources.list");
92 GetURL(TempFile, URL, TempFileDir);
93 int existed = file_dir_existed(
"./test_result/fossology.sources.list");
94 CU_ASSERT_EQUAL(existed, 1);
CU_TestInfo testcases_GetURL[]
testcases for function GetURL
void testGetURLNormal_URLIsOneFile()
The URL is one file.
int GetURLClean()
clean the env
int GetURLInit()
initialize
void testGetURLAbnormal_URLIsOneDir()
the URL is one dir
int RemoveDir(char *dirpath)
Remove all files under dirpath (rm -rf)
char GlobalParam[STRMAX]
Additional parameters.
int GetURL(char *TempFile, char *URL, char *TempFileDir)
Do the wget.