about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-05 00:43:37 +0000
committerJames Booth <boothj5@gmail.com>2014-01-05 00:43:37 +0000
commit80acfdae9acf523b8e1feaeabfb8147d93c38220 (patch)
tree266c1f02e559acb6199170b35b1b3fe6c754c0f9 /tests
parent9da4a6e1b9f13b253de3d029ef5cfb31a7109fa8 (diff)
downloadprofani-tty-80acfdae9acf523b8e1feaeabfb8147d93c38220.tar.gz
Added contact presence offline test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_contact.c13
-rw-r--r--tests/test_contact.h1
-rw-r--r--tests/testsuite.c1
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_contact.c b/tests/test_contact.c
index 332d6fd2..4952a271 100644
--- a/tests/test_contact.c
+++ b/tests/test_contact.c
@@ -100,3 +100,16 @@ void contact_string_when_default_resource(void **state)
     p_contact_free(contact);
     free(str);
 }
+
+void contact_presence_offline(void **state)
+{
+    PContact contact = p_contact_new("bob@server.com", "bob", NULL, "both",
+        "is offline", FALSE);
+
+    const char *presence = p_contact_presence(contact);
+
+    assert_string_equal("offline", presence);
+
+    p_contact_free(contact);
+
+}
diff --git a/tests/test_contact.h b/tests/test_contact.h
index f0ba043f..f196ff65 100644
--- a/tests/test_contact.h
+++ b/tests/test_contact.h
@@ -5,3 +5,4 @@ void contact_jid_when_name_not_exists(void **state);
 void contact_string_when_name_exists(void **state);
 void contact_string_when_name_not_exists(void **state);
 void contact_string_when_default_resource(void **state);
+void contact_presence_offline(void **state);
diff --git a/tests/testsuite.c b/tests/testsuite.c
index 71f2fdf9..6a107dd2 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -265,6 +265,7 @@ int main(int argc, char* argv[]) {
         unit_test(contact_string_when_name_exists),
         unit_test(contact_string_when_name_not_exists),
         unit_test(contact_string_when_default_resource),
+        unit_test(contact_presence_offline),
     };
     return run_tests(tests);
 }