OpenVPN
Functions
customer_database_test.c File Reference
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <database.h>
Include dependency graph for customer_database_test.c:

Go to the source code of this file.

Functions

DatabaseConnectionconnect_to_customer_database ()
 
unsigned int get_customer_id_by_name (DatabaseConnection *const connection, const char *const customer_name)
 
static unsigned int mock_query_database (DatabaseConnection *const connection, const char *const query_string, void ***const results)
 
DatabaseConnectionconnect_to_database (const char *const database_url, const unsigned int port)
 
static void test_connect_to_customer_database (void **state)
 
static void test_get_customer_id_by_name (void **state)
 
int main (void)
 

Function Documentation

◆ connect_to_customer_database()

DatabaseConnection* connect_to_customer_database ( )

Definition at line 29 of file customer_database.c.

References connect_to_database().

Referenced by test_connect_to_customer_database().

◆ connect_to_database()

DatabaseConnection* connect_to_database ( const char *const  database_url,
const unsigned int  port 
)

◆ get_customer_id_by_name()

unsigned int get_customer_id_by_name ( DatabaseConnection *const  connection,
const char *const  customer_name 
)

Definition at line 35 of file customer_database.c.

References DatabaseConnection::query_database, and snprintf.

Referenced by test_get_customer_id_by_name().

◆ main()

int main ( void  )

◆ mock_query_database()

static unsigned int mock_query_database ( DatabaseConnection *const  connection,
const char *const  query_string,
void ***const  results 
)
static

Definition at line 27 of file customer_database_test.c.

References mock_ptr_type.

Referenced by test_get_customer_id_by_name().

◆ test_connect_to_customer_database()

static void test_connect_to_customer_database ( void **  state)
static

◆ test_get_customer_id_by_name()

static void test_get_customer_id_by_name ( void **  state)
static