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

wip-NXPY-239: fix tests cases on python (Sourcery refactored) #272

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Sep 15, 2022

Pull Request #271 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the wip-NXPY-239-Fix-tests-cases-on-Python branch, then run:

git fetch origin sourcery/wip-NXPY-239-Fix-tests-cases-on-Python
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@CLAassistant
Copy link

CLAassistant commented Sep 15, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Sourcery AI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Sep 15, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.08%.

Quality metrics Before After Change
Complexity 2.26 ⭐ 2.23 ⭐ -0.03 👍
Method Length 51.89 ⭐ 51.91 ⭐ 0.02 👎
Working memory 5.19 ⭐ 5.17 ⭐ -0.02 👍
Quality 77.25% 77.33% 0.08% 👍
Other metrics Before After Change
Lines 3177 3171 -6
Changed files Quality Before Quality After Quality Change
nuxeo/client.py 64.45% 🙂 64.82% 🙂 0.37% 👍
nuxeo/documents.py 82.51% ⭐ 82.49% ⭐ -0.02% 👎
nuxeo/models.py 92.31% ⭐ 92.44% ⭐ 0.13% 👍
nuxeo/utils.py 66.49% 🙂 66.30% 🙂 -0.19% 👎
nuxeo/handlers/s3.py 71.91% 🙂 71.92% 🙂 0.01% 👍
tests/constants.py 96.17% ⭐ 96.01% ⭐ -0.16% 👎
tests/test_batchupload.py 66.70% 🙂 66.65% 🙂 -0.05% 👎
tests/test_log_response.py 93.50% ⭐ 93.41% ⭐ -0.09% 👎
tests/test_repository.py 83.56% ⭐ 83.56% ⭐ 0.00%
tests/manual/many_small_files.py 82.28% ⭐ 82.25% ⭐ -0.03% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
nuxeo/client.py NuxeoClient.request 14 🙂 307 ⛔ 16 ⛔ 30.76% 😞 Try splitting into smaller methods. Extract out complex expressions
nuxeo/utils.py version_compare 16 🙂 226 ⛔ 10 😞 41.75% 😞 Try splitting into smaller methods. Extract out complex expressions
tests/test_batchupload.py test_upload_several_callbacks 5 ⭐ 317 ⛔ 46.99% 😞 Try splitting into smaller methods
tests/test_batchupload.py test_idempotent_requests 5 ⭐ 300 ⛔ 47.77% 😞 Try splitting into smaller methods
nuxeo/utils.py log_response 10 🙂 163 😞 12 😞 48.26% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Base: 96.30% // Head: 96.30% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (28fb109) compared to base (1866b4d).
Patch coverage: 83.33% of modified lines in pull request are covered.

Additional details and impacted files
@@                            Coverage Diff                             @@
##           wip-NXPY-239-Fix-tests-cases-on-Python     #272      +/-   ##
==========================================================================
- Coverage                                   96.30%   96.30%   -0.01%     
==========================================================================
  Files                                          26       26              
  Lines                                        1624     1622       -2     
==========================================================================
- Hits                                         1564     1562       -2     
  Misses                                         60       60              
Flag Coverage Δ
unit 96.30% <83.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nuxeo/documents.py 93.60% <0.00%> (ø)
nuxeo/client.py 99.43% <100.00%> (-0.01%) ⬇️
nuxeo/handlers/s3.py 92.68% <100.00%> (ø)
nuxeo/models.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from c7e1ed5 to 22ce714 Compare September 15, 2022 06:04
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from e58750d to 957d6c4 Compare September 15, 2022 06:04
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 22ce714 to 9b1f45e Compare September 15, 2022 06:21
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 957d6c4 to d07f75c Compare September 15, 2022 06:21
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 9b1f45e to dd4ca0d Compare September 16, 2022 06:18
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from d07f75c to ffad8ac Compare September 16, 2022 06:18
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from dd4ca0d to 4c4f84f Compare September 16, 2022 06:50
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from ffad8ac to f843bf2 Compare September 16, 2022 06:51
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 4c4f84f to dde5bcc Compare September 16, 2022 07:03
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from f843bf2 to 8df80c1 Compare September 16, 2022 07:04
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from dde5bcc to 0d35141 Compare September 16, 2022 07:09
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 8df80c1 to 7fd7d4c Compare September 16, 2022 07:09
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 0d35141 to 0eeedce Compare September 16, 2022 07:16
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 7fd7d4c to 0f3f655 Compare September 16, 2022 07:16
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 0eeedce to d21ee43 Compare September 16, 2022 07:31
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 0f3f655 to 03a4a92 Compare September 16, 2022 07:31
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from d21ee43 to cab8070 Compare September 16, 2022 07:58
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 03a4a92 to 30af321 Compare September 16, 2022 07:58
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from cab8070 to 847af55 Compare September 16, 2022 08:08
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 30af321 to c2b3582 Compare September 16, 2022 08:09
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 847af55 to c128aa2 Compare September 16, 2022 10:05
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from c2b3582 to 0cb20d3 Compare September 16, 2022 10:06
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from c128aa2 to 631b5b5 Compare September 16, 2022 10:31
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 0cb20d3 to 28454f8 Compare September 16, 2022 10:32
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 631b5b5 to b8960ef Compare September 16, 2022 10:43
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 28454f8 to ea11e7f Compare September 16, 2022 10:44
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 384cde0 to cd5cd8d Compare October 13, 2022 11:30
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from bb4dc60 to 3490dd9 Compare October 13, 2022 11:39
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from cd5cd8d to 7c428aa Compare October 13, 2022 11:40
@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 3490dd9 to 643ff73 Compare October 13, 2022 11:45
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 7c428aa to 4d8086d Compare October 13, 2022 11:45
Comment on lines -163 to +168
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_digester refactored with the following changes:

Comment on lines -195 to +198
params={"document": WORKSPACE_ROOT + "/Document"},
params={"document": f"{WORKSPACE_ROOT}/Document"},
)
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document")

doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_execute refactored with the following changes:

Comment on lines -357 to +361
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute()
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document")
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_operation refactored with the following changes:

Comment on lines -430 to +441
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload refactored with the following changes:

Comment on lines -484 to +495
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload_several_callbacks refactored with the following changes:

self.url = nuxeo_url + "site/automation"
self.url = f"{nuxeo_url}site/automation"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseAutomation.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContentsTooLong.__init__ refactored with the following changes:

self.url = nuxeo_url + "json/cmis"
self.url = f"{nuxeo_url}json/cmis"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseCmis.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseEmpty.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextError.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextOk.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextTooLong.__init__ refactored with the following changes:

Comment on lines -195 to +196
assert len(aces) in (2, 3)
assert len(aces) in {2, 3}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_fetch_acls refactored with the following changes:

file_out = filename + ".dl"
file_out = f"{filename}.dl"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function download_file refactored with the following changes:

@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 643ff73 to 63746e7 Compare October 13, 2022 12:02
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 4d8086d to 13d9867 Compare October 13, 2022 12:03
Comment on lines -110 to +118
"User-Agent": app_name + "/" + version,
"User-Agent": f"{app_name}/{version}",
"Accept": "application/json, */*",
}

self.schemas = kwargs.get("schemas", "*")
self.repository = kwargs.pop("repository", "default")
self._session = requests.sessions.Session()
self._session.hooks["response"] = [log_response]
cookies = kwargs.pop("cookies", None)
if cookies:
if cookies := kwargs.pop("cookies", None):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.__init__ refactored with the following changes:

Comment on lines -184 to +186
data.update(params)
data |= params

url = self.api_path + "/search/lang/NXQL/execute"
url = f"{self.api_path}/search/lang/NXQL/execute"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.query refactored with the following changes:

kwargs.update(self.client_kwargs)
kwargs |= self.client_kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.request refactored with the following changes:

Comment on lines -402 to +401
error_data.update(response.json())
error_data |= response.json()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient._handle_error refactored with the following changes:

if "Internal Server Error" or "is not registered or unavailable" in e.message:
raise UnavailableBogusConvertor(e.message, \
options["converter"] if options["converter"] else "")
elif "is not registered" in e.message:
raise NotRegisteredConvertor(options)
elif (
"is not available" in e.message
or "UnsupportedOperationException" in e.message
):
raise UnavailableConvertor(options)
"""
elif "Internal Server Error" in e.message:
raise UnavailableBogusConvertor(e.message, \
options["converter"] if options["converter"] else "")
"""
raise e
raise UnavailableBogusConvertor(e.message, options["converter"] or "")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function API.convert refactored with the following changes:

Comment on lines -195 to +198
params={"document": WORKSPACE_ROOT + "/Document"},
params={"document": f"{WORKSPACE_ROOT}/Document"},
)
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document")

doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_execute refactored with the following changes:

Comment on lines -357 to +361
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute()
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document")
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_operation refactored with the following changes:

Comment on lines -430 to +441
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload refactored with the following changes:

Comment on lines -484 to +495
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload_several_callbacks refactored with the following changes:

self.url = nuxeo_url + "site/automation"
self.url = f"{nuxeo_url}site/automation"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseAutomation.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContentsTooLong.__init__ refactored with the following changes:

self.url = nuxeo_url + "json/cmis"
self.url = f"{nuxeo_url}json/cmis"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseCmis.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseEmpty.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextError.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextOk.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextTooLong.__init__ refactored with the following changes:

Comment on lines -195 to +196
assert len(aces) in (2, 3)
assert len(aces) in {2, 3}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_fetch_acls refactored with the following changes:

file_out = filename + ".dl"
file_out = f"{filename}.dl"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function download_file refactored with the following changes:

@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 63746e7 to 78ac896 Compare October 13, 2022 12:13
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 13d9867 to 2996f4f Compare October 13, 2022 12:14
Comment on lines -110 to +118
"User-Agent": app_name + "/" + version,
"User-Agent": f"{app_name}/{version}",
"Accept": "application/json, */*",
}

self.schemas = kwargs.get("schemas", "*")
self.repository = kwargs.pop("repository", "default")
self._session = requests.sessions.Session()
self._session.hooks["response"] = [log_response]
cookies = kwargs.pop("cookies", None)
if cookies:
if cookies := kwargs.pop("cookies", None):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.__init__ refactored with the following changes:

Comment on lines -184 to +186
data.update(params)
data |= params

url = self.api_path + "/search/lang/NXQL/execute"
url = f"{self.api_path}/search/lang/NXQL/execute"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.query refactored with the following changes:

kwargs.update(self.client_kwargs)
kwargs |= self.client_kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.request refactored with the following changes:

Comment on lines -402 to +401
error_data.update(response.json())
error_data |= response.json()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient._handle_error refactored with the following changes:

if "Internal Server Error" or "is not registered or unavailable" in e.message:
raise UnavailableBogusConvertor(options)
elif "is not registered" in e.message:
raise NotRegisteredConvertor(options)
elif (
"is not available" in e.message
or "UnsupportedOperationException" in e.message
):
raise UnavailableConvertor(options)
"""
elif "Internal Server Error" in e.message:
raise UnavailableBogusConvertor(e.message, \
options["converter"] if options["converter"] else "")
"""
raise e
raise UnavailableBogusConvertor(options)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function API.convert refactored with the following changes:

Comment on lines -163 to +168
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_digester refactored with the following changes:

Comment on lines -195 to +198
params={"document": WORKSPACE_ROOT + "/Document"},
params={"document": f"{WORKSPACE_ROOT}/Document"},
)
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document")

doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_execute refactored with the following changes:

Comment on lines -357 to +361
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute()
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document")
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_operation refactored with the following changes:

Comment on lines -430 to +441
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload refactored with the following changes:

Comment on lines -484 to +495
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload_several_callbacks refactored with the following changes:

self.url = nuxeo_url + "site/automation"
self.url = f"{nuxeo_url}site/automation"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseAutomation.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContentsTooLong.__init__ refactored with the following changes:

self.url = nuxeo_url + "json/cmis"
self.url = f"{nuxeo_url}json/cmis"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseCmis.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextError.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextOk.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextTooLong.__init__ refactored with the following changes:

Comment on lines -195 to +196
assert len(aces) in (2, 3)
assert len(aces) in {2, 3}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_fetch_acls refactored with the following changes:

file_out = filename + ".dl"
file_out = f"{filename}.dl"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function download_file refactored with the following changes:

@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 78ac896 to 621fd2d Compare October 13, 2022 13:58
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 2996f4f to c4a176d Compare October 13, 2022 13:59
Comment on lines -110 to +118
"User-Agent": app_name + "/" + version,
"User-Agent": f"{app_name}/{version}",
"Accept": "application/json, */*",
}

self.schemas = kwargs.get("schemas", "*")
self.repository = kwargs.pop("repository", "default")
self._session = requests.sessions.Session()
self._session.hooks["response"] = [log_response]
cookies = kwargs.pop("cookies", None)
if cookies:
if cookies := kwargs.pop("cookies", None):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.__init__ refactored with the following changes:

Comment on lines -184 to +186
data.update(params)
data |= params

url = self.api_path + "/search/lang/NXQL/execute"
url = f"{self.api_path}/search/lang/NXQL/execute"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.query refactored with the following changes:

kwargs.update(self.client_kwargs)
kwargs |= self.client_kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.request refactored with the following changes:

Comment on lines -402 to +401
error_data.update(response.json())
error_data |= response.json()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient._handle_error refactored with the following changes:

Comment on lines -365 to +360
input_obj = "doc:" + uid
input_obj = f"doc:{uid}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function API.trash refactored with the following changes:

Comment on lines -430 to +441
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload refactored with the following changes:

Comment on lines -484 to +495
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload_several_callbacks refactored with the following changes:

self.url = nuxeo_url + "site/automation"
self.url = f"{nuxeo_url}site/automation"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseAutomation.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContentsTooLong.__init__ refactored with the following changes:

self.url = nuxeo_url + "json/cmis"
self.url = f"{nuxeo_url}json/cmis"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseCmis.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseEmpty.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseError409.__init__ refactored with the following changes:

self.url = nuxeo_url + "700.3%20MiB.iso"
self.url = f"{nuxeo_url}700.3%20MiB.iso"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseIso.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextError.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextOk.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextTooLong.__init__ refactored with the following changes:

Comment on lines -199 to +196
assert len(aces) in (2, 3)
assert len(aces) in {2, 3}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_fetch_acls refactored with the following changes:

file_out = filename + ".dl"
file_out = f"{filename}.dl"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function download_file refactored with the following changes:

@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 621fd2d to 8dd3fd2 Compare October 13, 2022 14:04
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from c4a176d to 0c1e9ea Compare October 13, 2022 14:05
Comment on lines -110 to +118
"User-Agent": app_name + "/" + version,
"User-Agent": f"{app_name}/{version}",
"Accept": "application/json, */*",
}

self.schemas = kwargs.get("schemas", "*")
self.repository = kwargs.pop("repository", "default")
self._session = requests.sessions.Session()
self._session.hooks["response"] = [log_response]
cookies = kwargs.pop("cookies", None)
if cookies:
if cookies := kwargs.pop("cookies", None):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.__init__ refactored with the following changes:

Comment on lines -184 to +186
data.update(params)
data |= params

url = self.api_path + "/search/lang/NXQL/execute"
url = f"{self.api_path}/search/lang/NXQL/execute"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.query refactored with the following changes:

kwargs.update(self.client_kwargs)
kwargs |= self.client_kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.request refactored with the following changes:

Comment on lines -402 to +401
error_data.update(response.json())
error_data |= response.json()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient._handle_error refactored with the following changes:

Comment on lines -365 to +360
input_obj = "doc:" + uid
input_obj = f"doc:{uid}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function API.trash refactored with the following changes:

Comment on lines -430 to +441
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload refactored with the following changes:

Comment on lines -484 to +495
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload_several_callbacks refactored with the following changes:

self.url = nuxeo_url + "site/automation"
self.url = f"{nuxeo_url}site/automation"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseAutomation.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContentsTooLong.__init__ refactored with the following changes:

self.url = nuxeo_url + "json/cmis"
self.url = f"{nuxeo_url}json/cmis"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseCmis.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseEmpty.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseError409.__init__ refactored with the following changes:

self.url = nuxeo_url + "700.3%20MiB.iso"
self.url = f"{nuxeo_url}700.3%20MiB.iso"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseIso.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextError.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextOk.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextTooLong.__init__ refactored with the following changes:

assert len(aces) in (2, 3)
assert len(aces) in {2, 3}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_fetch_acls refactored with the following changes:

file_out = filename + ".dl"
file_out = f"{filename}.dl"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function download_file refactored with the following changes:

@gitofanindya gitofanindya force-pushed the wip-NXPY-239-Fix-tests-cases-on-Python branch from 8dd3fd2 to 1866b4d Compare October 13, 2022 14:14
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch from 0c1e9ea to 28fb109 Compare October 13, 2022 14:15
Comment on lines -110 to +118
"User-Agent": app_name + "/" + version,
"User-Agent": f"{app_name}/{version}",
"Accept": "application/json, */*",
}

self.schemas = kwargs.get("schemas", "*")
self.repository = kwargs.pop("repository", "default")
self._session = requests.sessions.Session()
self._session.hooks["response"] = [log_response]
cookies = kwargs.pop("cookies", None)
if cookies:
if cookies := kwargs.pop("cookies", None):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.__init__ refactored with the following changes:

Comment on lines -184 to +186
data.update(params)
data |= params

url = self.api_path + "/search/lang/NXQL/execute"
url = f"{self.api_path}/search/lang/NXQL/execute"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.query refactored with the following changes:

kwargs.update(self.client_kwargs)
kwargs |= self.client_kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient.request refactored with the following changes:

Comment on lines -402 to +401
error_data.update(response.json())
error_data |= response.json()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function NuxeoClient._handle_error refactored with the following changes:

input_obj = "doc:" + uid
input_obj = f"doc:{uid}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function API.trash refactored with the following changes:

Comment on lines -430 to +441
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload refactored with the following changes:

Comment on lines -484 to +495
operation.params = {"document": WORKSPACE_ROOT + "/Document"}
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"}
operation.input_obj = batch.get(0)
operation.execute(void_op=True)

operation = server.operations.new("Document.Fetch")
operation.params = {"value": WORKSPACE_ROOT + "/Document"}
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"}
info = operation.execute()
digest = info["properties"]["file:content"]["digest"]

operation = server.operations.new("Blob.Get")
operation.input_obj = WORKSPACE_ROOT + "/Document"
operation.input_obj = f"{WORKSPACE_ROOT}/Document"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_upload_several_callbacks refactored with the following changes:

self.url = nuxeo_url + "site/automation"
self.url = f"{nuxeo_url}site/automation"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseAutomation.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContents.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseChunkedJsonContentsTooLong.__init__ refactored with the following changes:

self.url = nuxeo_url + "json/cmis"
self.url = f"{nuxeo_url}json/cmis"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseCmis.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseEmpty.__init__ refactored with the following changes:

self.url = nuxeo_url + "nothing"
self.url = f"{nuxeo_url}nothing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseError409.__init__ refactored with the following changes:

self.url = nuxeo_url + "700.3%20MiB.iso"
self.url = f"{nuxeo_url}700.3%20MiB.iso"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseIso.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextError.__init__ refactored with the following changes:

self.url = nuxeo_url + "small%20file.txt"
self.url = f"{nuxeo_url}small%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextOk.__init__ refactored with the following changes:

self.url = nuxeo_url + "big%20file.txt"
self.url = f"{nuxeo_url}big%20file.txt"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function ResponseTextTooLong.__init__ refactored with the following changes:

assert len(aces) in (2, 3)
assert len(aces) in {2, 3}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function test_fetch_acls refactored with the following changes:

file_out = filename + ".dl"
file_out = f"{filename}.dl"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function download_file refactored with the following changes:

@sourcery-ai sourcery-ai bot closed this Oct 14, 2022
@sourcery-ai sourcery-ai bot deleted the sourcery/wip-NXPY-239-Fix-tests-cases-on-Python branch October 14, 2022 01:49
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.

None yet

1 participant