Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Shared Folders support #61

Merged
merged 22 commits into from
Jul 12, 2020
Merged

Add Shared Folders support #61

merged 22 commits into from
Jul 12, 2020

Conversation

Gestas
Copy link
Contributor

@Gestas Gestas commented Jun 29, 2020

Closes #60

  • add unit test
  • update readme

Includes support for extended attributes -

  • hidden
  • encryption
  • is_aclmode
  • unite_permission
  • is_support_acl
  • is_sync_share
  • is_force_readonly
  • force_readonly_reason
  • recyclebin
  • is_share_moving
  • is_cluster_share
  • is_exfat_share
  • enable_share_compress
  • enable_share_cow
  • include_cold_storage_share
  • is_cold_storage_share

@Quentame Quentame self-requested a review July 1, 2020 13:44
@Quentame Quentame added this to the 0.9.0 milestone Jul 1, 2020
Copy link
Collaborator

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is stuff we can improve related to _execute_request, will tell you a bit later.

README.rst Show resolved Hide resolved
synology_dsm/api/core/share.py Outdated Show resolved Hide resolved
tests/test_synology_dsm.py Show resolved Hide resolved
synology_dsm/api/core/share.py Outdated Show resolved Hide resolved
synology_dsm/synology_dsm.py Outdated Show resolved Hide resolved
synology_dsm/synology_dsm.py Outdated Show resolved Hide resolved
@Gestas
Copy link
Contributor Author

Gestas commented Jul 1, 2020

Re: _execute_request -
It looks like to me like post(), _request(), and _execute_request() in synology_dsm.py were designed to support file uploads, I had to force my usage more that I would like to, see synology_dsm.py 230-243 and 282-286.

Finding a better way to handle this would be great.

Copy link
Collaborator

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix tests:

tests/init.py:135: url += urlencode(params) --> url += urlencode(params or {})

@Gestas
Copy link
Contributor Author

Gestas commented Jul 2, 2020

@Quentame I can't figure out the issue with the test, I'll need your help.

synology_dsm/api/core/share.py Outdated Show resolved Hide resolved
synology_dsm/api/core/share.py Outdated Show resolved Hide resolved
synology_dsm/api/core/share.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the CI passes, I'll merge.

I'll see the SynologyDSM._request() when I will have more time.

tests/test_synology_dsm.py Outdated Show resolved Hide resolved
@Gestas
Copy link
Contributor Author

Gestas commented Jul 8, 2020

@Quentame I can't fix the CI, I need you to take a look. You have permissions to directly update the pull request if that's easier for you. The error -

$ pytest
============================================================================= test session starts ==============================================================================
platform linux -- Python 3.7.5, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: .../python-synology, inifile: setup.cfg, testpaths: tests
collected 55 items                                                                                                                                                             

tests/test_synology_dsm.py ......................F............                                                                                                           [ 63%]
tests/test_synology_dsm_5.py ....................                                                                                                                        [100%]

=================================================================================== FAILURES ===================================================================================
_________________________________________________________________________ TestSynologyDSM.test_shares __________________________________________________________________________

self = <tests.test_synology_dsm.TestSynologyDSM testMethod=test_shares>

    def test_shares(self):
        """Test shares."""
        assert self.api.share
        self.api.share.update()
>       assert self.api.share.shares
E       AssertionError: assert []
E        +  where [] = <synology_dsm.api.core.share.SynoShare object at 0x7f1ffc9992d0>.shares
E        +    where <synology_dsm.api.core.share.SynoShare object at 0x7f1ffc9992d0> = <tests.SynologyDSMMock object at 0x7f1ffc982790>.share
E        +      where <tests.SynologyDSMMock object at 0x7f1ffc982790> = <tests.test_synology_dsm.TestSynologyDSM testMethod=test_shares>.api

tests/test_synology_dsm.py:726: AssertionError
=========================================================================== short test summary info ============================================================================
FAILED tests/test_synology_dsm.py::TestSynologyDSM::test_shares - AssertionError: assert []
========================================================================= 1 failed, 54 passed in 1.18s =========================================================================

@Quentame
Copy link
Collaborator

Quentame commented Jul 9, 2020

The test URL is not built correctly : WARNING tests:__init__.py:141 https://nas.mywebsite.me:443/webapi/entry.cgi?

@Quentame
Copy link
Collaborator

Quentame commented Jul 9, 2020

@Quentame
Copy link
Collaborator

Quentame commented Jul 9, 2020

Are you sure we should POST and not GET ?

https://github.com/N4S4/synology-api/blob/aa0fb41c50b8fb4b1c94a78872fb78e5087b12a3/synology_api/sys_info.py#L80-L86

Is telling me GET

OK, yes, this is POST 👍

@Quentame
Copy link
Collaborator

Quentame commented Jul 9, 2020

I’ve tested, your code is working well but tests fails.
So test mock code is involved but I don’t know yet what is it.
Searching...

@Quentame
Copy link
Collaborator

Quentame commented Jul 10, 2020

@Gestas : can you check if the test share.share_size is right ?

EDIT : tested on my NAS, working (but on much lower disk capacity 😅)

Copy link
Collaborator

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this.

Waiting your last test to merge (since I modified some stuffs, working on my DS918+ NAS).

@Gestas
Copy link
Contributor Author

Gestas commented Jul 11, 2020

@Gestas : can you check if the test share.share_size is right ?

EDIT : tested on my NAS, working (but on much lower disk capacity sweat_smile)

Everything is working locally, I'm good to merge. Thx!

@Quentame Quentame merged commit 27379e7 into ProtoThis:master Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Shared Folders
2 participants