Adding gc_backend tests
[gc-dialer] / src / gc_backend.py
index 7600604..ec02e90 100644 (file)
@@ -70,7 +70,7 @@ class GCDialer(object):
                        self._browser.cookies.load()
 
                self._accessToken = None
-               self._accountNum = None
+               self._accountNum = ""
                self._lastAuthed = 0.0
                self._callbackNumbers = {}
 
@@ -240,7 +240,7 @@ class GCDialer(object):
                for c in self._browser.cookies:
                        if c.name == "pda_forwarding_number":
                                return c.value
-               return None
+               return ""
 
        def get_recent(self):
                """
@@ -331,9 +331,10 @@ class GCDialer(object):
                self._accessToken = atGroup.group(1)
 
                anGroup = self._accountNumRe.search(data)
-               if anGroup is None:
-                       raise RuntimeError("Could not extract account number from GrandCentral")
-               self._accountNum = anGroup.group(1)
+               if anGroup is not None:
+                       self._accountNum = anGroup.group(1)
+               else:
+                       warnings.warn("Could not extract account number from GrandCentral", UserWarning, 2)
 
                self._callbackNumbers = {}
                for match in self._callbackRe.finditer(data):