This repository was archived by the owner on Jul 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 119
Adapted PR 120 to new structure #143
Closed
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7cb35e5
Adapted PR 120 to new structure
SergioBertolinSG 1606e34
Making difference between versions
SergioBertolinSG 3a42b37
Raising manually skiptest exceptions
SergioBertolinSG 593b160
Version returns a string, parsing that string
SergioBertolinSG 213e036
modified logic and comparing integers instead of strings
SergioBertolinSG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -567,9 +567,15 @@ def test_copy_to_non_existing_dir(self): | |
| ) | ||
|
|
||
| @data_provider(files) | ||
| def test_share_with_link(self, file_name): | ||
| def test_share_with_link_lesser_8_2(self, file_name): | ||
| """Test sharing a file with link""" | ||
|
|
||
| current_version = self.client.get_version().split('.') | ||
| current_version_major = current_version[0] | ||
| current_version_minor = current_version[1] | ||
| if ((current_version_major >= '8') and (current_version_minor >= '2')): | ||
| raise unittest.SkipTest("This test should not run against >=8.2 servers"); | ||
|
|
||
| path = self.test_root + file_name | ||
| self.assertTrue(self.client.put_file_contents(path, 'hello world!')) | ||
|
|
||
|
|
@@ -582,6 +588,30 @@ def test_share_with_link(self, file_name): | |
| self.assertTrue(type(share_info.get_link()) is str) | ||
| self.assertTrue(type(share_info.get_token()) is str) | ||
|
|
||
| @data_provider(files) | ||
| def test_share_with_link_greater_8_2(self, file_name): | ||
| """Test sharing a file with link""" | ||
|
|
||
| current_version = self.client.get_version().split('.') | ||
| current_version_major = current_version[0] | ||
| current_version_minor = current_version[1] | ||
| if ((current_version_major < '8') or ((current_version_major == '8') and (current_version_minor < '2'))): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should the string be converted to an int first ? Not sure what the comparison does, maybe byte-wise ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thats right. (not sure why it didn't failed) |
||
| raise unittest.SkipTest("This test should not run against <8.2 servers"); | ||
|
|
||
| path = self.test_root + file_name | ||
| self.assertTrue(self.client.put_file_contents(path, 'hello world!')) | ||
|
|
||
| share_info = self.client.share_file_with_link(path, public_upload=True, password='1234', expiration='2150-02-04') | ||
|
|
||
| self.assertTrue(self.client.is_shared(path)) | ||
| self.assertTrue(isinstance(share_info, owncloud.ShareInfo)) | ||
| self.assertTrue(type(share_info.get_id()) is int) | ||
| self.assertEquals(share_info.get_path(), path) | ||
| self.assertTrue(type(share_info.get_link()) is str) | ||
| self.assertTrue(type(share_info.get_token()) is str) | ||
| self.assertEquals(share_info.get_permissions(), 7) | ||
| self.assertEquals(share_info.get_expiration(), '2150-02-04 00:00:00') | ||
|
|
||
| def test_share_with_link_non_existing_file(self): | ||
| """Test sharing a file with link""" | ||
| with self.assertRaises(owncloud.ResponseError) as e: | ||
|
|
@@ -781,6 +811,17 @@ def test_update_share_user(self): | |
| self.assertEqual(int(perms), self.client.OCS_PERMISSION_ALL) | ||
| self.assertTrue(self.client.delete_share(share_id)) | ||
|
|
||
| def test_update_share_expiration(self): | ||
| """Test updating a share parameters - expiration date""" | ||
| path = self.test_root + 'update_share_expiration' | ||
| self.client.mkdir(path) | ||
| share_info = self.client.share_file_with_link(path) | ||
| share_id = share_info.get_id() | ||
| self.assertTrue(self.client.update_share(share_id, expiration='2150-02-04')) | ||
| share_info = self.client.get_shares(path)[0] | ||
| self.assertEquals(share_info.get_expiration(), '2150-02-04 00:00:00') | ||
| self.assertTrue(self.client.delete_share(share_id)) | ||
|
|
||
| def test_update_share_public(self): | ||
| """Test updating a share parameters - public share""" | ||
| path = self.test_root + 'update_share_public.txt' | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean "This test should not run against < 8.2 servers" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that string is correct, which is not correct is the logic, it should check the major before, I'll change it.