8#include <cgreen/cgreen.h>
9#include <cgreen/mocks.h>
19Ensure (osp, osp_new_target_never_returns_null)
24 assert_that (target, is_not_null);
33Ensure (osp, osp_get_vts_no_vts_ret_error)
36 assert_that (
osp_get_vts (conn, NULL), is_equal_to (1));
40Ensure (osp, osp_get_vts_no_conn_ret_error)
42 assert_that (
osp_get_vts (NULL, NULL), is_equal_to (1));
52 assert_true (target->
icmp);
55 assert_true (target->
arp);
65 gchar *expected_xml_string;
70 target_xml = g_string_sized_new (10240);
73 expected_xml_string =
"<target>"
74 "<hosts>127.0.0.1</hosts>"
75 "<exclude_hosts></exclude_hosts>"
76 "<finished_hosts></finished_hosts>"
78 "<alive_test_methods>"
80 "<tcp_syn>1</tcp_syn>"
81 "<tcp_ack>1</tcp_ack>"
83 "<consider_alive>0</consider_alive>"
84 "</alive_test_methods>"
87 assert_that (target_xml->str, is_equal_to_string (expected_xml_string));
90 g_string_free (target_xml, TRUE);
96main (
int argc,
char **argv)
101 suite = create_test_suite ();
103 add_test_with_context (suite, osp, osp_new_target_never_returns_null);
104 add_test_with_context (suite, osp, osp_get_vts_no_conn_ret_error);
105 add_test_with_context (suite, osp, osp_get_vts_no_vts_ret_error);
106 add_test_with_context (suite, osp, osp_new_conn_ret_null);
111 ret = run_single_test (suite, argv[1], create_text_reporter ());
113 ret = run_test_suite (suite, create_text_reporter ());
115 destroy_test_suite (suite);
API for Open Scanner Protocol communication.
void osp_target_add_alive_test_methods(osp_target_t *target, gboolean icmp, gboolean tcp_syn, gboolean tcp_ack, gboolean arp, gboolean consider_alive)
Add alive test methods to OSP target.
int osp_get_vts(osp_connection_t *connection, entity_t *vts)
Get all VTs from an OSP server.
void osp_target_free(osp_target_t *target)
Free an OSP target, including all added credentials.
static void target_append_as_xml(osp_target_t *target, GString *xml_string)
Concatenate a target as XML.
osp_target_t * osp_target_new(const char *hosts, const char *ports, const char *exclude_hosts, int alive_test, int reverse_lookup_unify, int reverse_lookup_only)
Create a new OSP target.
struct osp_connection osp_connection_t
struct osp_target osp_target_t
osp_connection_t * osp_connection_new(const char *, int, const char *, const char *, const char *)
int main(int argc, char **argv)
Ensure(osp, osp_new_target_never_returns_null)