aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2013-08-05 16:30:21 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2013-08-05 21:05:35 +0300
commit00a7d1af9f0b1658f74fca00cff339696d326c4d (patch)
treedf163e2ff63f0c43f707cba6f75d1b5653786982
parent920f5aba1aeee312502c8af69cf09aedf5b89e27 (diff)
downloadtor-00a7d1af9f0b1658f74fca00cff339696d326c4d.tar
tor-00a7d1af9f0b1658f74fca00cff339696d326c4d.tar.gz
test_pt_configure_proxy(): verify the internals of the managed proxy.
-rw-r--r--src/test/test_pt.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index f969457d0..e4aa39f86 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -321,7 +321,7 @@ get_or_state_replacement(void)
static void
test_pt_configure_proxy(void *arg)
{
- int i;
+ int i, retval;
managed_proxy_t *mp = NULL;
(void) arg;
@@ -346,9 +346,21 @@ test_pt_configure_proxy(void *arg)
times while it is uninitialized and then finally finalizing its
configuration. */
for (i = 0 ; i < 5 ; i++) {
- test_assert(configure_proxy(mp) == 0);
+ retval = configure_proxy(mp);
+ /* retval should be zero because proxy hasn't finished configuring yet */
+ test_assert(retval == 0);
+ /* check the number of registered transports */
+ test_assert(smartlist_len(mp->transports) == i+1);
+ /* check that the mp is still waiting for transports */
+ test_assert(mp->conf_state == PT_PROTO_ACCEPTING_METHODS);
}
- test_assert(configure_proxy(mp) == 1);
+
+ /* this last configure_proxy() should finalize the proxy configuration. */
+ retval = configure_proxy(mp);
+ /* retval should be 1 since the proxy finished configuring */
+ test_assert(retval == 1);
+ /* check the mp state */
+ test_assert(mp->conf_state == PT_PROTO_COMPLETED);
done:
tor_free(dummy_state);