FOSSology  4.4.0
Open Source License Compliance by Open Source Software
testGetURL.c File Reference

testing for the function GetURL() More...

#include <CUnit/CUnit.h>
#include "wget_agent.h"
#include "utility.h"
#include "libfodbreposysconf.h"
Include dependency graph for testGetURL.c:

Go to the source code of this file.

Functions

int GetURLInit ()
 initialize
 
int GetURLClean ()
 clean the env
 
void testGetURLNormal_URLIsOneFile ()
 The URL is one file. More...
 
void testGetURLAbnormal_URLIsOneDir ()
 the URL is one dir More...
 

Variables

static char TempFile [MAX_LENGTH]
 
static char URL [MAX_LENGTH]
 
static char TempFileDir [MAX_LENGTH]
 
CU_TestInfo testcases_GetURL []
 testcases for function GetURL More...
 

Detailed Description

testing for the function GetURL()

int GetURL(char *TempFile, char *URL, char *TempFileDir) char *TempFile - used when upload from URL by the scheduler, the downloaded file(directory) will be archived as this file when running from command, this parameter is null, e.g. /var/local/lib/fossology/agents/wget.32732

char *URL - the url you want to download

char *TempFileDir - where you want to store your downloaded file(directory)

return int, 0 on success, non-zero on failure.

Definition in file testGetURL.c.

Function Documentation

◆ testGetURLAbnormal_URLIsOneDir()

void testGetURLAbnormal_URLIsOneDir ( )

the URL is one dir

TempFileDir is ./test_result TempFile is not empty

Test:
  1. Set wget parameters to include several files
  2. Load a URL for a file
  3. Set the TempFileDir and TempFile
  4. Call GetURL()
  5. Check if the files were downloaded

Definition at line 86 of file testGetURL.c.

◆ testGetURLNormal_URLIsOneFile()

void testGetURLNormal_URLIsOneFile ( )

The URL is one file.

TempFileDir is ./test_result, TempFile is empty

Test:
  1. Load a single file URL
  2. Set the TempFileDir
  3. Call GetURL()
  4. Check if the file got downloaded

Definition at line 65 of file testGetURL.c.

Variable Documentation

◆ testcases_GetURL

CU_TestInfo testcases_GetURL[]
Initial value:
=
{
CU_TEST_INFO_NULL
}
void testGetURLNormal_URLIsOneFile()
The URL is one file.
Definition: testGetURL.c:65
void testGetURLAbnormal_URLIsOneDir()
the URL is one dir
Definition: testGetURL.c:86

testcases for function GetURL

Definition at line 100 of file testGetURL.c.