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

unit test for GetMetadataDebBinary function More...

#include "pkgagent.h"
#include <stdio.h>
#include "CUnit/CUnit.h"
Include dependency graph for testGetMetadataDebBinary.c:

Go to the source code of this file.

Macros

#define MAXSQL   4096
 

Functions

long prepare_Database (PGconn *db_conn, struct debpkginfo *pi)
 Prepare database. More...
 
int prepare_Repository ()
 Prepare repository. More...
 
int remove_Database (PGconn *db_conn, struct debpkginfo *pi, long upload_pk)
 remove database More...
 
int remove_Repository ()
 remove repository More...
 
void test_GetMetadataDebBinary ()
 Test pkgagent.c GetMetadataDebBinary function get Debian binary package info. More...
 
void test_GetMetadataDebBinary_no_uploadpk ()
 Test pkgagent.c GetMetadataDebBinary function with no upload_pk in database. More...
 
void test_ProcessUpload ()
 Test pkgagent.c ProcessUpload function. More...
 

Variables

char * DBConfFile
 DB conf file location.
 
CU_TestInfo testcases_GetMetadataDebBinary []
 testcases for function GetMetadataDebBinary and ProcessUpload More...
 

Detailed Description

unit test for GetMetadataDebBinary function

Definition in file testGetMetadataDebBinary.c.

Function Documentation

◆ prepare_Database()

long prepare_Database ( PGconn *  db_conn,
struct debpkginfo pi 
)

Prepare database.

Parameters
db_connthe database connection
pithe pointer of debpkginfo
Returns
upload_pk on OK, -1 on failure

Definition at line 24 of file testGetMetadataDebBinary.c.

◆ prepare_Repository()

int prepare_Repository ( )

Prepare repository.

Returns
0 on OK, -1 on failure

Definition at line 195 of file testGetMetadataDebBinary.c.

◆ remove_Database()

int remove_Database ( PGconn *  db_conn,
struct debpkginfo pi,
long  upload_pk 
)

remove database

Parameters
db_connthe database connection
pithe pointer of debpkginfo
upload_pk
Returns
0 on OK, -1 on failure

Definition at line 217 of file testGetMetadataDebBinary.c.

◆ remove_Repository()

int remove_Repository ( )

remove repository

Returns
0 on OK, -1 on failure

Definition at line 306 of file testGetMetadataDebBinary.c.

◆ test_GetMetadataDebBinary()

void test_GetMetadataDebBinary ( )

Test pkgagent.c GetMetadataDebBinary function get Debian binary package info.

Test:
  1. Load a test file in database
  2. Pass test file id to GetMetadataDebBinary()
  3. Check if meta data is parsed properly

Definition at line 328 of file testGetMetadataDebBinary.c.

◆ test_GetMetadataDebBinary_no_uploadpk()

void test_GetMetadataDebBinary_no_uploadpk ( )

Test pkgagent.c GetMetadataDebBinary function with no upload_pk in database.

Test:
  1. Pass 0 to GetMetadataDebBinary() as upload_pk
  2. Check if function return -1

Definition at line 390 of file testGetMetadataDebBinary.c.

◆ test_ProcessUpload()

void test_ProcessUpload ( )

Test pkgagent.c ProcessUpload function.

Give the upload_pk of debian binary package, get the package information about this upload id

Test:
  1. Create a test entry in database for an upload
  2. Call ProcessUpload() on the upload
  3. Check if run was success

Definition at line 426 of file testGetMetadataDebBinary.c.

Variable Documentation

◆ testcases_GetMetadataDebBinary

CU_TestInfo testcases_GetMetadataDebBinary[]
Initial value:
= {
{"Testing the function GetMetadataDebBinary", test_GetMetadataDebBinary},
{"Testing the function GetMetadataDebBinary with no uploadpk", test_GetMetadataDebBinary_no_uploadpk},
{"Testing the function ProcessUpload for debian binary package", test_ProcessUpload},
CU_TEST_INFO_NULL
}
void test_ProcessUpload()
Test pkgagent.c ProcessUpload function.
void test_GetMetadataDebBinary()
Test pkgagent.c GetMetadataDebBinary function get Debian binary package info.
void test_GetMetadataDebBinary_no_uploadpk()
Test pkgagent.c GetMetadataDebBinary function with no upload_pk in database.

testcases for function GetMetadataDebBinary and ProcessUpload

Definition at line 468 of file testGetMetadataDebBinary.c.