def test_container_init_fails_without_connection_attribute():
    with pytest.raises(AttributeError):
        FugaContainer("")
def test_get_file_fails_on_not_existing(fuga_container):
    with pytest.raises(AttributeError):
        FugaContainer(fuga_container).get('testing')
def test_container_init_fail_when_connection_attribute_is_none(fuga_container):
    fuga_container.connection = None
    with pytest.raises(ValueError):
        FugaContainer(fuga_container)
def test_download_file_fails_on_using_binairy_file(fuga_container):
    with BytesIO(b'') as f:
        f.mode = 'w'
        with pytest.raises(IOError):
            FugaContainer(fuga_container).download(f, 'testing')
def test_download_file_success(fuga_container):
    with BytesIO(b'') as f:
        f.mode = 'wb'
        FugaContainer(fuga_container).download(f, load_from='1') == 'success'
        f.name = '2'
        FugaContainer(fuga_container).download(f) == 'success'
def test_upload_file_fails_on_using_non_binairy_file(fuga_container):
    with BytesIO(b'hallo') as f:
        f.mode = 'r'
        with pytest.raises(IOError):
            FugaContainer(fuga_container).upload(f, 'testing')
def test_upload_file_success(fuga_container):
    with BytesIO(b'hallo') as f:
        f.mode = 'rb'
        FugaContainer(fuga_container).upload(f, 'testing') == 'success'
        f.name = 'testing'
        FugaContainer(fuga_container).upload(f) == 'success'
def test_delete_correctly(fuga_container):
    assert FugaContainer(fuga_container).delete('1') == "'1' deleted"