conduit r1274 - in trunk: . conduit/modules/GmailModule test/python-tests
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1274 - in trunk: . conduit/modules/GmailModule test/python-tests
- Date: Tue, 5 Feb 2008 06:20:29 +0000 (GMT)
Author: jstowers
Date: Tue Feb 5 06:20:29 2008
New Revision: 1274
URL: http://svn.gnome.org/viewvc/conduit?rev=1274&view=rev
Log:
2008-02-05 John Stowers <john stowers gmail com>
* conduit/modules/GmailModule/GmailModule.py: Share some more code with
the GmailEmailTwoWay dataprovider
* test/python-tests/TestDataProviderGmail.py:
* test/python-tests/common.py: Test GmailContactSource
Modified:
trunk/ChangeLog
trunk/conduit/modules/GmailModule/GmailModule.py
trunk/test/python-tests/TestDataProviderGmail.py
trunk/test/python-tests/common.py
Modified: trunk/conduit/modules/GmailModule/GmailModule.py
==============================================================================
--- trunk/conduit/modules/GmailModule/GmailModule.py (original)
+++ trunk/conduit/modules/GmailModule/GmailModule.py Tue Feb 5 06:20:29 2008
@@ -58,26 +58,12 @@
def get_UID(self):
return self.username
- def _message_exists(self, msgid):
- """
- Utility function to check if a message exists. Does so by searching
- the raw message contents for certain seemingly compulsory strings;
- (taken from RFC 822)
- 1) Received
- 2) Date
- 4) Subject
- I do it this way because if the message is not found then gmail returns
- a help message that may change in future. RFC822 wont change.
- """
- raw = self.ga.getRawMessage(msgid)
- try:
- raw.index("Received")
- raw.index("Date")
- raw.index("Subject")
- return True
- except ValueError:
- return False
-
+ def get_configuration(self):
+ return {
+ "username" : self.username,
+ "password" : self.password,
+ }
+
class GmailEmailTwoWay(GmailBase, DataProvider.TwoWay):
_name_ = _("Gmail Emails")
@@ -287,16 +273,14 @@
self.mails = None
def get_configuration(self):
- return {
- "username" : self.username,
- "password" : self.password,
- "getAllEmail" : self.getAllEmail,
- "getUnreadEmail" : self.getUnreadEmail,
- "getWithLabel" : self.getWithLabel,
- "getInFolder" : self.getInFolder
- }
-
-
+ conf = GmailBase.get_configuration(self)
+ conf.update({
+ "getAllEmail" : self.getAllEmail,
+ "getUnreadEmail" : self.getUnreadEmail,
+ "getWithLabel" : self.getWithLabel,
+ "getInFolder" : self.getInFolder})
+ return conf
+
class GmailContactSource(GmailBase, DataProvider.DataSource):
_name_ = _("Gmail Contacts")
@@ -368,9 +352,3 @@
self.password = passwordEntry.get_text()
dlg.destroy()
- def get_configuration(self):
- return {
- "username" : self.username,
- "password" : self.password,
- }
-
Modified: trunk/test/python-tests/TestDataProviderGmail.py
==============================================================================
--- trunk/test/python-tests/TestDataProviderGmail.py (original)
+++ trunk/test/python-tests/TestDataProviderGmail.py Tue Feb 5 06:20:29 2008
@@ -36,6 +36,17 @@
data=e,
name="email"
)
+
+#Now test the contact source
+test = SimpleTest(sinkName="GmailContactSource")
+test.configure(sink=config)
+test.do_dataprovider_tests(
+ supportsGet=True,
+ supportsDelete=False,
+ safeLUID="john stowers gmail com",
+ data=None,
+ name="contact"
+ )
finished()
Modified: trunk/test/python-tests/common.py
==============================================================================
--- trunk/test/python-tests/common.py (original)
+++ trunk/test/python-tests/common.py Tue Feb 5 06:20:29 2008
@@ -373,13 +373,14 @@
the data to get
"""
#Test put()
- try:
- rid = self.sink.module.put(data, True)
- uid = rid.get_UID()
- ok("Put a %s (%s) " % (name,rid), True)
- except Exception, err:
- traceback.print_exc()
- ok("Put a %s (%s)" % (name,err), False)
+ if data:
+ try:
+ rid = self.sink.module.put(data, True)
+ uid = rid.get_UID()
+ ok("Put a %s (%s) " % (name,rid), True)
+ except Exception, err:
+ traceback.print_exc()
+ ok("Put a %s (%s)" % (name,err), False)
#Test get()
if supportsGet:
@@ -400,12 +401,13 @@
ok("Get %s (%s)" % (desc,err), False)
#Test put() to replace
- try:
- rid = self.sink.module.put(data, True, uid)
- ok("Update %s (%s)" % (name,rid), True)
- except Exception, err:
- traceback.print_exc()
- ok("Update %s (%s)" % (name,err), False)
+ if data:
+ try:
+ rid = self.sink.module.put(data, True, uid)
+ ok("Update %s (%s)" % (name,rid), True)
+ except Exception, err:
+ traceback.print_exc()
+ ok("Update %s (%s)" % (name,err), False)
#Test delete()
if supportsDelete:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]