Пример #1
0
def test_googlephotos_batch():
    with open('%s/config.ini-googlephotos-batch' % gettempdir(), 'w') as f:
        f.write(config_string_fmt)
    if hasattr(load_config, 'config'):
        del load_config.config

    final_file_path = helper.get_file('plain.jpg')
    gp = GooglePhotos()
    gp.after('', '', final_file_path, sample_metadata)
    db_row = gp.db.get(final_file_path)
    assert db_row == 'foobar', db_row

    status, count = gp.batch()
    db_row_after = gp.db.get(final_file_path)
    assert status == True, status
    assert count == 1, count
    assert db_row_after is None, db_row_after


    if hasattr(load_config, 'config'):
        del load_config.config

        
    gp.set_session()
    status = gp.upload(helper.get_file('invalid.jpg'))
    
    assert status is None, status
Пример #2
0
def test_googlephotos_upload():
    with open('%s/config.ini-googlephotos-upload' % gettempdir(), 'w') as f:
        f.write(config_string_fmt)
    if hasattr(load_config, 'config'):
        del load_config.config

    gp = GooglePhotos()

    if hasattr(load_config, 'config'):
        del load_config.config

    gp.set_session()
    status = gp.upload(helper.get_file('plain.jpg'))
    
    assert status is not None, status
Пример #3
0
def test_googlephotos_upload_dne():
    with open('%s/config.ini-googlephotos-upload-dne' % gettempdir(), 'w') as f:
        f.write(config_string_fmt)
    if hasattr(load_config, 'config'):
        del load_config.config

    gp = GooglePhotos()

    if hasattr(load_config, 'config'):
        del load_config.config

    gp.set_session()
    status = gp.upload('/file/does/not/exist')
    
    assert status is None, status