[telepathy-mission-control/master] McdAccount: start from RequestedPresence == Offline rather than Unset

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Jun 25 10:40:54 PDT 2009


This means that various tests need to stop asserting that our requested
presence is initially Unset, but that was wrong all along really.
---
 src/mcd-account.c                                  |    5 ++++-
 test/twisted/account-manager/auto-away.py          |    9 +++------
 .../twisted/account-manager/create-auto-connect.py |    4 ----
 .../twisted/account-manager/enable-auto-connect.py |    4 ----
 test/twisted/account-manager/enable.py             |    4 ----
 test/twisted/dispatcher/connect-for-request.py     |    4 ----
 .../twisted/dispatcher/request-disabled-account.py |    4 ----
 test/twisted/test-connect.py                       |   13 -------------
 8 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/src/mcd-account.c b/src/mcd-account.c
index af2df9e..e0d2ed4 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -1806,7 +1806,6 @@ account_reconnect (TpSvcAccount *service,
     /* if we can't, or don't want to, connect this method is a no-op */
     if (!self->priv->enabled ||
         !self->priv->valid ||
-        self->priv->req_presence_type == TP_CONNECTION_PRESENCE_TYPE_UNSET ||
         self->priv->req_presence_type == TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
     {
         DEBUG ("doing nothing (enabled=%c, valid=%c and "
@@ -2168,6 +2167,10 @@ mcd_account_init (McdAccount *account)
 					McdAccountPrivate);
     account->priv = priv;
 
+    priv->req_presence_type = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
+    priv->req_presence_status = g_strdup ("offline");
+    priv->req_presence_message = g_strdup ("");
+
     priv->auto_presence_type = TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
     priv->auto_presence_status = g_strdup ("available");
     priv->auto_presence_message = g_strdup ("");
diff --git a/test/twisted/account-manager/auto-away.py b/test/twisted/account-manager/auto-away.py
index 98fc095..1d1a18c 100644
--- a/test/twisted/account-manager/auto-away.py
+++ b/test/twisted/account-manager/auto-away.py
@@ -38,13 +38,10 @@ def test(q, bus, mc):
     properties = account.GetAll(cs.ACCOUNT,
             dbus_interface=cs.PROPERTIES_IFACE)
     assert properties is not None
-    # the requested presence is defined by Connection_Presence_Type:
-    #  Connection_Presence_Type_Unset = 0
-    #  Connection_Presence_Type_Offline = 1
-    #  Connection_Presence_Type_Available = 2
     assert properties.get('RequestedPresence') == \
-        dbus.Struct((dbus.UInt32(0L), dbus.String(u''), dbus.String(u''))), \
-        properties.get('RequestedPresence')  # FIXME: we should expect 1
+        dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE),
+            'offline', '')), \
+        properties.get('RequestedPresence')
 
     # Go online
     requested_presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_AVAILABLE),
diff --git a/test/twisted/account-manager/create-auto-connect.py b/test/twisted/account-manager/create-auto-connect.py
index 5297be2..8e788ed 100644
--- a/test/twisted/account-manager/create-auto-connect.py
+++ b/test/twisted/account-manager/create-auto-connect.py
@@ -22,10 +22,6 @@ def test(q, bus, mc):
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
     q.expect('dbus-return', method='Set')
-    q.expect('dbus-signal', signal='AccountPropertyChanged',
-            predicate=lambda e:
-                e.args[0].get('RequestedPresence', (None, None, None))[1]
-                    == 'offline')
 
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'AutomaticPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy',
diff --git a/test/twisted/account-manager/enable-auto-connect.py b/test/twisted/account-manager/enable-auto-connect.py
index e41a42f..d091d4a 100644
--- a/test/twisted/account-manager/enable-auto-connect.py
+++ b/test/twisted/account-manager/enable-auto-connect.py
@@ -22,10 +22,6 @@ def test(q, bus, mc):
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
     q.expect('dbus-return', method='Set')
-    q.expect('dbus-signal', signal='AccountPropertyChanged',
-            predicate=lambda e:
-                e.args[0].get('RequestedPresence', (None, None, None))[1]
-                    == 'offline')
 
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'AutomaticPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy',
diff --git a/test/twisted/account-manager/enable.py b/test/twisted/account-manager/enable.py
index 2b8a8cf..795c5b3 100644
--- a/test/twisted/account-manager/enable.py
+++ b/test/twisted/account-manager/enable.py
@@ -20,10 +20,6 @@ def test(q, bus, mc):
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
     q.expect('dbus-return', method='Set')
-    q.expect('dbus-signal', signal='AccountPropertyChanged',
-            predicate=lambda e:
-                e.args[0].get('RequestedPresence', (None, None, None))[1]
-                    == 'offline')
 
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'Enabled', False)
     q.expect('dbus-return', method='Set')
diff --git a/test/twisted/dispatcher/connect-for-request.py b/test/twisted/dispatcher/connect-for-request.py
index 4f17d71..13cb8f6 100644
--- a/test/twisted/dispatcher/connect-for-request.py
+++ b/test/twisted/dispatcher/connect-for-request.py
@@ -24,10 +24,6 @@ def test(q, bus, mc):
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
     q.expect('dbus-return', method='Set')
-    q.expect('dbus-signal', signal='AccountPropertyChanged',
-            predicate=lambda e:
-                e.args[0].get('RequestedPresence', (None, None, None))[1]
-                    == 'offline')
 
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'AutomaticPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy',
diff --git a/test/twisted/dispatcher/request-disabled-account.py b/test/twisted/dispatcher/request-disabled-account.py
index 500b93d..7a36061 100644
--- a/test/twisted/dispatcher/request-disabled-account.py
+++ b/test/twisted/dispatcher/request-disabled-account.py
@@ -21,10 +21,6 @@ def test(q, bus, mc):
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
     q.expect('dbus-return', method='Set')
-    q.expect('dbus-signal', signal='AccountPropertyChanged',
-            predicate=lambda e:
-                e.args[0].get('RequestedPresence', (None, None, None))[1]
-                    == 'offline')
 
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'AutomaticPresence',
             (dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy',
diff --git a/test/twisted/test-connect.py b/test/twisted/test-connect.py
index 21e6b16..6e299bd 100644
--- a/test/twisted/test-connect.py
+++ b/test/twisted/test-connect.py
@@ -48,19 +48,6 @@ def test(q, bus, mc):
     assert account.Get(cs.ACCOUNT, 'Valid',
             dbus_interface=cs.PROPERTIES_IFACE)
 
-    # Check the requested presence is offline
-    properties = account.GetAll(cs.ACCOUNT,
-            dbus_interface=cs.PROPERTIES_IFACE)
-    assert properties is not None
-    # the requested presence is defined by Connection_Presence_Type:
-    #  Connection_Presence_Type_Unset = 0
-    #  Connection_Presence_Type_Offline = 1
-    #  Connection_Presence_Type_Available = 2
-    assert properties.get('RequestedPresence') == \
-        dbus.Struct((dbus.UInt32(0L), dbus.String(u''), dbus.String(u''))), \
-        properties.get('RequestedPresence')  # FIXME: we should expect 1
-    assert properties.get('HasBeenOnline') == False
-
     # Go online
     requested_presence = dbus.Struct((dbus.UInt32(2L), dbus.String(u'brb'),
                 dbus.String(u'Be back soon!')))
-- 
1.5.6.5




More information about the telepathy-commits mailing list