コード例 #1
0
ファイル: test_software.c プロジェクト: KThand1/profanity
// Typical use case for gateways that don't support resources
void
display_software_version_result_when_from_domainpart(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost\">"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    prof_output_exact("Buddy1 is online, \"I'm here\"");

    stbbr_for_query("jabber:iq:version",
        "<iq id=\"*\" type=\"result\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"localhost\">"
            "<query xmlns=\"jabber:iq:version\">"
                "<name>Some Gateway</name>"
                "<version>1.0</version>"
            "</query>"
        "</iq>"
    );
    prof_input("/software buddy1@localhost/__prof_default");

//    assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
//    assert_true(prof_output_exact("Name    : Some Gateway"));
    assert_true(prof_output_exact("Version : 1.0"));
}
コード例 #2
0
ファイル: proftest.c プロジェクト: 0xPoly/profanity
void
prof_connect_with_roster(char *roster)
{
    GString *roster_str = g_string_new(
        "<iq type='result' to='stabber@localhost/profanity'>"
            "<query xmlns='jabber:iq:roster' ver='362'>"
    );
    g_string_append(roster_str, roster);
    g_string_append(roster_str,
            "</query>"
        "</iq>"
    );

    stbbr_for_query("jabber:iq:roster", roster_str->str);
    g_string_free(roster_str, TRUE);

    stbbr_for_id("prof_presence_1",
        "<presence id='prof_presence_1' lang='en' to='stabber@localhost/profanity' from='stabber@localhost/profanity'>"
            "<priority>0</priority>"
            "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='f8mrtdyAmhnj8Ca+630bThSL718='/>"
        "</presence>"
    );

    prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
    prof_input("password");

    // Allow time for profanity to connect
    exp_timeout = 30;
    assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
    exp_timeout = 10;
    stbbr_wait_for("prof_presence_*");
}
コード例 #3
0
ファイル: test_software.c プロジェクト: KThand1/profanity
void
display_software_version_result(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"");

    stbbr_for_query("jabber:iq:version",
        "<iq id=\"*\" type=\"result\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
            "<query xmlns=\"jabber:iq:version\">"
                "<name>Profanity</name>"
                "<version>0.4.7dev.master.2cb2f83</version>"
            "</query>"
        "</iq>"
    );
    prof_input("/software buddy1@localhost/mobile");

//    assert_true(prof_output_exact("buddy1@localhost/mobile:"));
//    assert_true(prof_output_exact("Name    : Profanity"));
    assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
}
コード例 #4
0
ファイル: proftest.c プロジェクト: brandenbyers/profanity
void
prof_connect_with_roster(char *roster)
{
    GString *roster_str = g_string_new(
        "<iq type=\"result\" to=\"stabber@localhost/profanity\">"
            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
    );
    g_string_append(roster_str, roster);
    g_string_append(roster_str,
            "</query>"
        "</iq>"
    );

    stbbr_for_query("jabber:iq:roster", roster_str->str);
    g_string_free(roster_str, TRUE);

    stbbr_for_id("prof_presence_1",
        "<presence id=\"prof_presence_1\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost/profanity\">"
            "<priority>0</priority>"
            "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"f8mrtdyAmhnj8Ca+630bThSL718=\"/>"
        "</presence>"
    );

    prof_input("/connect stabber@localhost port 5230");
    prof_input("password");

    // Allow time for profanity to connect
    exp_timeout = 30;
    assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
    exp_timeout = 10;
    stbbr_wait_for("prof_presence_*");
}
コード例 #5
0
ファイル: test_software.c プロジェクト: KThand1/profanity
void
shows_message_when_software_version_error(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"");

    stbbr_for_query("jabber:iq:version",
        "<iq id=\"*\" lang=\"en\" type=\"error\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/laptop\">"
            "<query xmlns=\"jabber:iq:version\"/>"
            "<error code=\"503\" type=\"cancel\">"
                "<service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
            "</error>"
        "</iq>"
    );
    prof_input("/software buddy1@localhost/laptop");

    assert_true(prof_output_exact("Could not get software version: service-unavailable"));
}