summaryrefslogtreecommitdiff
path: root/tests/unit/test_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* chore: consolidate license and authorsNejc Habjan2022-08-041-17/+0
|
* fix: use the [] after key names for array variables in `params`John L. Villalovos2022-07-271-3/+25
| | | | | | | | | | | | | | | | | | 1. If a value is of type ArrayAttribute then append '[]' to the name of the value for query parameters (`params`). This is step 3 in a series of steps of our goal to add full support for the GitLab API data types[1]: * array * hash * array of hashes Step one was: commit 5127b1594c00c7364e9af15e42d2e2f2d909449b Step two was: commit a57334f1930752c70ea15847a39324fa94042460 Fixes: #1698 [1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types
* refactor: avoid possible breaking change in iterator (#2107)John Villalovos2022-06-271-1/+1
| | | | | | | | Commit b6447211754e126f64e12fc735ad74fe557b7fb4 inadvertently introduced a possible breaking change as it added a new argument `iterator` and added it in between existing (potentially positional) arguments. This moves the `iterator` argument to the end of the argument list and requires it to be a keyword-only argument.
* feat(downloads): allow streaming downloads access to response iterator (#1956)Tom Catshoek2022-06-261-1/+3
| | | | | | | | | | | | | | | * feat(downloads): allow streaming downloads access to response iterator Allow access to the underlying response iterator when downloading in streaming mode by specifying `iterator=True`. Update type annotations to support this change. * docs(api-docs): add iterator example to artifact download Document the usage of the `iterator=True` option when downloading artifacts * test(packages): add tests for streaming downloads
* chore: have `EncodedId` creation always return `EncodedId`John L. Villalovos2022-05-311-2/+4
| | | | | | | | There is no reason to return an `int` as we can always return a `str` version of the `int` Change `EncodedId` to always return an `EncodedId`. This removes the need to have `mypy` ignore the error raised.
* test(gitlab): increase unit test coverageNejc Habjan2022-05-291-0/+52
|
* refactor(mixins): extract custom type transforms into utilsNejc Habjan2022-05-291-1/+28
|
* chore: create a custom `warnings.warn` wrapperJohn L. Villalovos2022-02-061-0/+19
| | | | | | | Create a custom `warnings.warn` wrapper that will walk the stack trace to find the first frame outside of the `gitlab/` path to print the warning against. This will make it easier for users to find where in their code the error is generated from
* chore: replace usage of utils._url_encode() with utils.EncodedId()jlvillal/encoded_idJohn L. Villalovos2022-01-131-23/+2
| | | | | | utils.EncodedId() has basically the same functionalityy of using utils._url_encode(). So remove utils._url_encode() as we don't need it.
* chore: add EncodedId string class to use to hold URL-encoded pathsJohn L. Villalovos2022-01-131-0/+62
| | | | | | | | | Add EncodedId string class. This class returns a URL-encoded string but ensures it will only URL-encode it once even if recursively called. Also added some functional tests of 'lazy' objects to make sure they work.
* fix: remove custom URL encodingJohn L. Villalovos2022-01-081-4/+9
| | | | | | | | | | We were using `str.replace()` calls to take care of URL encoding issues. Switch them to use our `utils._url_encode()` function which itself uses `urllib.parse.quote()` Closes: #1356
* fix: stop encoding '.' to '%2E'jlvillal/leave_dotJohn L. Villalovos2021-12-201-10/+0
| | | | | | | | | | | | | | | | | | | | Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Closes #1006 Related #1356 Related #1561 BREAKING CHANGE: stop encoding '.' to '%2E'. This could potentially be a breaking change for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.
* chore: move 'gitlab/tests/' dir to 'tests/unit/'John L. Villalovos2021-05-261-0/+42
Move the 'gitlab/tests/' directory to 'tests/unit/' so we have all the tests located under the 'tests/' directory.