Example #1
0
class testPicasaUnixNetwork(unittest.TestCase):
    
    """
    A test class for the PicasaKit module.
    System:
    Windows 7
    Picasa 3
    Network Database
    """

    def setUp(self):
        """
        set up data used in the tests.
        setUp is called before each test function execution.
        """
        
        
        db_path = "smb://10.0.0.11/tom/picasa/Local Settings/Application Data/Google/Picasa2Albums"
        protocol = PicasaKit().createProtocolFromString(db_path)
        protocol.connect(username = "******", password = "", ip = "10.0.0.11")
        location = PicasaKit().createLocation(protocol)
        
        # search for dbid...
        m = re.match('\w+://(.+)', db_path)
        location.search_database('/' + m.group(1))
        
        # init
        self.picasa = PicasaKit().createDatabase(location)
        
        

    def test_ListAlbums(self):
        #
        self.assertNotEqual( len(self.picasa.albums()), 0 )


    def test_ReadAlbum(self):
        #
        from picasa import Album
        self.assertNotEqual( self.picasa.album('84de3f2a5eb450e1aad57eaa7da06623'), Album)
Example #2
0
class testPicasaLinuxDefault(unittest.TestCase):
    
    """
    A test class for the PicasaKit module.
    System:
    Ubuntu 10.10
    Picasa 3
    Default Database
    """

    def setUp(self):
        """
        set up data used in the tests.
        setUp is called before each test function execution.
        """
        
        
        db_path = "file://" + os.path.join(os.getenv('HOME'), '.google', 'picasa', '3.0', 'drive_c', 'Documents and Settings', os.getenv('USER'), 'Local Settings', 'Application Data', 'Google', 'Picasa2Albums')
        protocol = PicasaKit().createProtocolFromString(db_path)
        location = PicasaKit().createLocation(protocol)
        
        # search for dbid...
        m = re.match('\w+://(.*)', db_path)
        location.search_database(m.group(1))
        
        # init
        self.picasa = PicasaKit().createDatabase(location)
        
        

    def test_ListAlbums(self):
        # 
        self.assertNotEqual( len(self.picasa.albums()), 0 )


    def test_ReadAlbum(self):
        # 
        from picasa import Album
        self.assertNotEqual( self.picasa.album('21f2c0b53018628cbea72ad28503a41d'), Album)