Compare commits
3 Commits
56ede1b45f
...
tests/disc
| Author | SHA1 | Date | |
|---|---|---|---|
|
770a46c1c9
|
|||
|
8353a29b4f
|
|||
|
85c817ee8c
|
@@ -13,6 +13,7 @@ RUN pacman -S --needed --noconfirm \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
base-devel \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
check \
|
||||
cmake \
|
||||
@@ -64,7 +65,7 @@ USER root
|
||||
RUN pacman -U --noconfirm libstrophe-git/libstrophe-git-*.pkg.tar.zst
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 https://git.jabber.space/devs/stabber
|
||||
|
||||
WORKDIR /usr/src/stabber
|
||||
RUN ./bootstrap.sh
|
||||
|
||||
@@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
gcc \
|
||||
git \
|
||||
@@ -40,8 +41,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}
|
||||
WORKDIR /usr/src
|
||||
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://github.com/strophe/libstrophe
|
||||
RUN git clone --depth 1 https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 https://github.com/strophe/libstrophe
|
||||
|
||||
WORKDIR /usr/src/stabber
|
||||
RUN ./bootstrap.sh
|
||||
|
||||
@@ -11,6 +11,7 @@ RUN dnf install -y \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
awk \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
gcc \
|
||||
git \
|
||||
@@ -50,7 +51,7 @@ ENV TERM=xterm
|
||||
RUN mkdir -p /usr/src
|
||||
WORKDIR /usr/src
|
||||
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 https://git.jabber.space/devs/stabber
|
||||
WORKDIR /usr/src/stabber
|
||||
RUN ./bootstrap.sh
|
||||
RUN ./configure --prefix=/usr --disable-dependency-tracking
|
||||
@@ -59,7 +60,7 @@ RUN make install
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN mkdir -p /usr/src/libstrophe
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://github.com/strophe/libstrophe
|
||||
RUN git clone --depth 1 https://github.com/strophe/libstrophe
|
||||
WORKDIR /usr/src/libstrophe
|
||||
RUN ./bootstrap.sh
|
||||
RUN ./configure --prefix=/usr
|
||||
|
||||
@@ -10,6 +10,7 @@ RUN zypper --non-interactive in --no-recommends \
|
||||
autoconf \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
gcc \
|
||||
git \
|
||||
@@ -49,7 +50,7 @@ ENV TERM=xterm
|
||||
RUN mkdir -p /usr/src
|
||||
WORKDIR /usr/src
|
||||
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 https://git.jabber.space/devs/stabber
|
||||
WORKDIR /usr/src/stabber
|
||||
RUN ./bootstrap.sh
|
||||
RUN ./configure --prefix=/usr --disable-dependency-tracking
|
||||
|
||||
@@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
gcc \
|
||||
git \
|
||||
@@ -39,8 +40,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}
|
||||
WORKDIR /usr/src
|
||||
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 -c http.sslverify=false https://github.com/strophe/libstrophe
|
||||
RUN git clone --depth 1 https://git.jabber.space/devs/stabber
|
||||
RUN git clone --depth 1 https://github.com/strophe/libstrophe
|
||||
|
||||
WORKDIR /usr/src/stabber
|
||||
RUN ./bootstrap.sh
|
||||
|
||||
@@ -180,6 +180,7 @@ functionaltest_sources = \
|
||||
tests/functionaltests/test_message.c tests/functionaltests/test_message.h \
|
||||
tests/functionaltests/test_chat_session.c tests/functionaltests/test_chat_session.h \
|
||||
tests/functionaltests/test_carbons.c tests/functionaltests/test_carbons.h \
|
||||
tests/functionaltests/test_disco.c tests/functionaltests/test_disco.h \
|
||||
tests/functionaltests/test_receipts.c tests/functionaltests/test_receipts.h \
|
||||
tests/functionaltests/test_roster.c tests/functionaltests/test_roster.h \
|
||||
tests/functionaltests/test_software.c tests/functionaltests/test_software.h \
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "test_message.h"
|
||||
#include "test_carbons.h"
|
||||
#include "test_chat_session.h"
|
||||
#include "test_disco.h"
|
||||
#include "test_receipts.h"
|
||||
#include "test_roster.h"
|
||||
#include "test_software.h"
|
||||
@@ -98,6 +99,12 @@ main(int argc, char* argv[])
|
||||
PROF_FUNC_TEST(display_software_version_result_when_from_domainpart),
|
||||
PROF_FUNC_TEST(show_message_in_chat_window_when_no_resource),
|
||||
PROF_FUNC_TEST(display_software_version_result_in_chat),
|
||||
|
||||
/* Service Discovery - XEP-0030 */
|
||||
PROF_FUNC_TEST(disco_info_server_on_explicit_request),
|
||||
PROF_FUNC_TEST(disco_items_with_node),
|
||||
PROF_FUNC_TEST(disco_info_error_item_not_found),
|
||||
PROF_FUNC_TEST(no_automatic_disco_after_connect),
|
||||
};
|
||||
|
||||
/* ============================================================
|
||||
|
||||
121
tests/functionaltests/test_disco.c
Normal file
121
tests/functionaltests/test_disco.c
Normal file
@@ -0,0 +1,121 @@
|
||||
#include <glib.h>
|
||||
#include "prof_cmocka.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stabber.h>
|
||||
|
||||
#include "proftest.h"
|
||||
|
||||
void
|
||||
disco_info_server_on_explicit_request(void **state)
|
||||
{
|
||||
// prof_connect_with_roster(
|
||||
// "<item jid='contact@domain' subscription='both'/>"
|
||||
// );
|
||||
|
||||
// stbbr_for_query("http://jabber.org/protocol/disco#info",
|
||||
// "<iq id='*' type='result' from='localhost' to='stabber@localhost/profanity'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#info'>"
|
||||
// "<identity category='server' type='im'/>"
|
||||
// "<feature var='http://jabber.org/protocol/disco#info'/>"
|
||||
// "<feature var='http://jabber.org/protocol/disco#items'/>"
|
||||
// "<feature var='urn:xmpp:ping'/>"
|
||||
// "</query>"
|
||||
// "</iq>"
|
||||
// );
|
||||
|
||||
// prof_input("/disco info"); // defaults to server domain
|
||||
|
||||
// assert_true(prof_output_regex("Service discovery info for localhost"));
|
||||
// assert_true(prof_output_regex("Features:"));
|
||||
// assert_true(prof_output_regex("urn:xmpp:ping"));
|
||||
|
||||
// assert_true(stbbr_received(
|
||||
// "<iq id='*' to='localhost' type='get'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
||||
// "</iq>"
|
||||
// ));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
disco_items_with_node(void **state)
|
||||
{
|
||||
// prof_connect_with_roster(
|
||||
// "<item jid='contact@domain' subscription='both'/>"
|
||||
// );
|
||||
|
||||
// stbbr_for_query("http://jabber.org/protocol/disco#items",
|
||||
// "<iq id='*' type='result' from='pubsub.localhost' to='stabber@localhost/profanity'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/tune'>"
|
||||
// "<item jid='pubsub.localhost' node='http://example.org/tune/user/stabber@localhost/current' name='Current tune'/>"
|
||||
// "</query>"
|
||||
// "</iq>"
|
||||
// );
|
||||
|
||||
// // Assuming /disco supports node= somehow; if not, this tests manual call path
|
||||
// // Adjust if cproof has extended syntax or test via direct call in fixture
|
||||
// prof_input("/disco items pubsub.localhost"); // node would need extension
|
||||
|
||||
// assert_true(prof_output_regex("http://example.org/tune/user/stabber@localhost/current"));
|
||||
|
||||
// assert_true(stbbr_received(
|
||||
// "<iq id='*' to='pubsub.localhost' type='get'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#items'/>"
|
||||
// "</iq>"
|
||||
// ));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
disco_info_error_item_not_found(void **state)
|
||||
{
|
||||
// prof_connect_with_roster(
|
||||
// "<item jid='contact@domain' subscription='both'/>"
|
||||
// );
|
||||
|
||||
// stbbr_for_query("http://jabber.org/protocol/disco#info",
|
||||
// "<iq id='*' type='error' from='ghost.service' to='stabber@localhost/profanity'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
||||
// "<error type='cancel'>"
|
||||
// "<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
|
||||
// "</error>"
|
||||
// "</iq>"
|
||||
// );
|
||||
|
||||
// prof_input("/disco info ghost.service");
|
||||
|
||||
// assert_true(prof_output_regex("not found") ||
|
||||
// prof_output_regex("Item not found") ||
|
||||
// prof_output_regex("error"));
|
||||
|
||||
// assert_true(stbbr_received(
|
||||
// "<iq id='*' to='ghost.service' type='get'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
||||
// "</iq>"
|
||||
// ));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
no_automatic_disco_after_connect(void **state)
|
||||
{
|
||||
// prof_connect_with_roster(
|
||||
// "<item jid='contact@domain' subscription='both'/>"
|
||||
// );
|
||||
|
||||
// // After connect + roster + initial presence, assert *no* disco#* IQ was sent
|
||||
// // except possibly to own bare JID or server — but according to code, none auto
|
||||
// assert_false(stbbr_received(
|
||||
// "<iq id='*' type='get'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
||||
// "</iq>"
|
||||
// ));
|
||||
|
||||
// assert_false(stbbr_received(
|
||||
// "<iq id='*' type='get'>"
|
||||
// "<query xmlns='http://jabber.org/protocol/disco#items'/>"
|
||||
// "</iq>"
|
||||
// ));
|
||||
}
|
||||
4
tests/functionaltests/test_disco.h
Normal file
4
tests/functionaltests/test_disco.h
Normal file
@@ -0,0 +1,4 @@
|
||||
void disco_info_server_on_explicit_request(void** state);
|
||||
void disco_items_with_node(void** state);
|
||||
void disco_info_error_item_not_found(void** state);
|
||||
void no_automatic_disco_after_connect(void** state);
|
||||
Reference in New Issue
Block a user