summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* test(functional): fix GitLab configuration to support paginationJohn L. Villalovos2022-02-053-4/+4
| | | | | | | | | | | | When pagination occurs python-gitlab uses the URL provided by the GitLab server to use for the next request. We had previously set the GitLab server configuraiton to say its URL was `http://gitlab.test` which is not in DNS. Set the hostname in the URL to `http://127.0.0.1:8080` which is the correct URL for the GitLab server to be accessed while doing functional tests. Closes: #1877
* test(services): add functional tests for servicesNejc Habjan2022-02-032-1/+43
|
* test(objects): add tests for project artifactsNejc Habjan2022-02-012-7/+114
|
* fix: remove custom `delete` method for labelsJohn L. Villalovos2022-02-012-3/+10
| | | | | | | | | | | | | | The usage of deleting was incorrect according to the current API. Remove custom `delete()` method as not needed. Add tests to show it works with labels needing to be encoded. Also enable the test_group_labels() test function. Previously it was disabled. Add ability to do a `get()` for group labels. Closes: #1867
* chore: create new ArrayAttribute classJohn L. Villalovos2022-01-301-12/+30
| | | | | | | | | | | | | | | | | | | | | Create a new ArrayAttribute class. This is to indicate types which are sent to the GitLab server as arrays https://docs.gitlab.com/ee/api/#array At this stage it is identical to the CommaSeparatedListAttribute class but will be used later to support the array types sent to GitLab. This is the second step 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 [1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types Related: #1698
* chore: remove redundant list comprehensionNejc Habjan2022-01-231-1/+1
|
* style: use f-strings where applicableNejc Habjan2022-01-232-11/+6
|
* chore: consistently use open() encoding and file descriptorNejc Habjan2022-01-232-4/+4
|
* chore: always use context manager for file IONejc Habjan2022-01-231-1/+2
|
* style: use literals to declare data structuresNejc Habjan2022-01-232-2/+2
|
* chore: remove old-style classesNejc Habjan2022-01-232-4/+4
|
* chore: rename `types.ListAttribute` to `types.CommaSeparatedListAttribute`John L. Villalovos2022-01-221-12/+12
| | | | | | | | | | | This name more accurately describes what the type is. Also this is the first step in a series of steps of our goal to add full support for the GitLab API data types[1]: * array * hash * array of hashes [1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types
* test: add a meta test to make sure that v4/objects/ files are importedJohn L. Villalovos2022-01-221-0/+32
| | | | | Add a test to make sure that all of the `gitlab/v4/objects/` files are imported in `gitlab/v4/objects/__init__.py`
* fix(cli): allow custom methods in managersNejc Habjan2022-01-222-0/+36
|
* fix(objects): make resource access tokens and repos available in CLINejc Habjan2022-01-221-0/+16
|
* test: convert usage of `match_querystring` to `match`jlvillal/rm_httmockJohn L. Villalovos2022-01-164-101/+104
| | | | | In the `responses` library the usage of `match_querystring` is deprecated. Convert to using `match`
* test: remove usage of httpmock libraryJohn L. Villalovos2022-01-151-223/+388
| | | | | Convert all usage of the `httpmock` library to using the `responses` library.
* Merge pull request #1838 from python-gitlab/jlvillal/version_mvNejc Habjan2022-01-151-1/+1
|\ | | | | chore: rename `gitlab/__version__.py` to `gitlab/_version.py`
| * chore: rename `gitlab/__version__.py` -> `gitlab/_version.py`jlvillal/version_mvJohn L. Villalovos2022-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is confusing to have a `gitlab/__version__.py` because we also create a variable `gitlab.__version__` which can conflict with `gitlab/__version__.py`. For example in `gitlab/const.py` we have to know that `gitlab.__version__` is a module and not the variable due to the ordering of imports. But in most other usage `gitlab.__version__` is a version string. To reduce confusion make the name of the version file `gitlab/_version.py`.
* | test: use 'responses' in test_mixins_methods.pyJohn L. Villalovos2022-01-141-146/+191
| | | | | | | | | | | | Convert from httmock to responses in test_mixins_methods.py This leaves only one file left to convert
* | chore(tests): use method `projects.transfer()`jlvillal/catch_warningsJohn L. Villalovos2022-01-131-2/+2
|/ | | | | | When doing the functional tests use the new function `projects.transfer` instead of the deprecated function `projects.transfer_project()`
* test(groups): enable group transfer testsNejc Habjan2022-01-133-10/+11
|
* feat(api): add `project.transfer()` and deprecate `transfer_project()`Nejc Habjan2022-01-134-5/+78
|
* Merge pull request #1819 from python-gitlab/jlvillal/encoded_idNejc Habjan2022-01-136-15/+134
|\ | | | | fix: use url-encoded ID in all paths
| * chore: replace usage of utils._url_encode() with utils.EncodedId()jlvillal/encoded_idJohn L. Villalovos2022-01-132-24/+3
| | | | | | | | | | | | 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-136-2/+113
| | | | | | | | | | | | | | | | | | 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: use url-encoded ID in all pathsJohn L. Villalovos2022-01-132-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | Make sure all usage of the ID in the URL path is encoded. Normally it isn't an issue as most IDs are integers or strings which don't contain a slash ('/'). But when the ID is a string with a slash character it will break things. Add a test case that shows this fixes wikis issue with subpages which use the slash character. Closes: #1079
* | Merge pull request #1827 from python-gitlab/jlvillal/all_objectsNejc Habjan2022-01-131-0/+28
|\ \ | |/ |/| fix: members: use new *All objects for *AllManager managers
| * fix(members): use new *All objects for *AllManager managersJohn L. Villalovos2022-01-131-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change it so that: GroupMemberAllManager uses GroupMemberAll object ProjectMemberAllManager uses ProjectMemberAll object Create GroupMemberAll and ProjectMemberAll objects that do not support any Mixin type methods. Previously we were using GroupMember and ProjectMember which support the `save()` and `delete()` methods but those methods will not work with objects retrieved using the `/members/all/` API calls. `list()` API calls: [1] GET /groups/:id/members/all GET /projects/:id/members/all `get()` API calls: [2] GET /groups/:id/members/all/:user_id GET /projects/:id/members/all/:user_id Closes: #1825 Closes: #848 [1] https://docs.gitlab.com/ee/api/members.html#list-all-members-of-a-group-or-project-including-inherited-and-invited-members [2] https://docs.gitlab.com/ee/api/members.html#get-a-member-of-a-group-or-project-including-inherited-and-invited-members
* | fix(api): services: add missing `lazy` parameterjlvillal/lazy_serviceJohn L. Villalovos2022-01-131-0/+11
|/ | | | | | | | Commit 8da0b758c589f608a6ae4eeb74b3f306609ba36d added the `lazy` parameter to the services `get()` method but missed then using the `lazy` parameter when it called `super(...).get(...)` Closes: #1828
* feat: add support for Group Access Token APIFabio Huser2022-01-091-0/+113
| | | | See https://docs.gitlab.com/ee/api/group_access_tokens.html
* docs: update project access token API reference linkFabio Huser2022-01-091-1/+1
|
* Merge pull request #1812 from python-gitlab/jlvillal/pprintNejc Habjan2022-01-091-0/+30
|\ | | | | chore: add `pprint()` and `pformat()` methods to RESTObject
| * chore: add `pprint()` and `pformat()` methods to RESTObjectJohn L. Villalovos2022-01-081-0/+30
| | | | | | | | | | This is useful in debugging and testing. As can easily print out the values from an instance in a more human-readable form.
* | Merge pull request #1786 from python-gitlab/jlvillal/loggingNejc Habjan2022-01-091-16/+46
|\ \ | | | | | | test: add logging to `tests/functional/conftest.py`
| * | chore: add logging to `tests/functional/conftest.py`John L. Villalovos2022-01-081-16/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have found trying to debug issues in the functional tests can be difficult. Especially when trying to figure out failures in the CI running on Github. Add logging to `tests/functional/conftest.py` to have a better understanding of what is happening during a test run which is useful when trying to troubleshoot issues in the CI.
* | | fix: remove custom URL encodingJohn L. Villalovos2022-01-082-6/+15
|/ / | | | | | | | | | | | | | | | | | | 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: remove default arguments for mergerequests.merge()John L. Villalovos2022-01-081-1/+3
| | | | | | | | | | | | | | | | | | | | The arguments `should_remove_source_branch` and `merge_when_pipeline_succeeds` are optional arguments. We should not be setting any default value for them. https://docs.gitlab.com/ee/api/merge_requests.html#accept-mr Closes: #1750
* | fix(cli): url-encode path components of the URLJohn L. Villalovos2022-01-083-11/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | In the CLI we need to make sure the components put into the path portion of the URL are url-encoded. Otherwise they will be interpreted as part of the path. For example can specify the project ID as a path, but in the URL it must be url-encoded or it doesn't work. Also stop adding the components of the path as query parameters in the URL. Closes: #783 Closes: #1498
* | chore: fix functional test failure if config presentJohn L. Villalovos2022-01-081-5/+4
|/ | | | | Previously c8256a5933d745f70c7eea0a7d6230b51bac0fbc was done to fix this but it missed two other failures.
* chore: add functional test of mergerequest.get()jlvillal/test_1425John L. Villalovos2022-01-031-0/+16
| | | | | | | Add a functional test of test mergerequest.get() and mergerequest.get(..., lazy=True) Closes: #1425
* chore: add test case to show branch name with period worksjlvillal/dot_branchJohn L. Villalovos2022-01-031-0/+17
| | | | | | | Add a test case to show that a branch name with a period can be fetched with a `get()` Closes: #1715
* feat(cli): allow options from args and environment variablesNejc Habjan2022-01-023-11/+184
| | | | | | | | BREAKING-CHANGE: The gitlab CLI will now accept CLI arguments and environment variables for its global options in addition to configuration file options. This may change behavior for some workflows such as running inside GitLab CI and with certain environment variables configured.
* chore: fix functional test failure if config presentjlvillal/cli_testJohn L. Villalovos2022-01-011-4/+8
| | | | | | | Fix functional test failure if config present and configured with token. Closes: #1791
* fix: handle situation where GitLab does not return valuesjlvillal/paginationJohn L. Villalovos2021-12-301-3/+2
| | | | | | | | | | | | | | | | If a query returns more than 10,000 records than the following values are NOT returned: x.total_pages x.total Modify the code to allow no value to be set for these values. If there is not a value returned the functions will now return None. Update unit test so no longer `xfail` https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headers Closes #1686
* test: reproduce missing pagination headers in testsNejc Habjan2021-12-301-0/+30
|
* test: drop httmock dependency in test_gitlab.pyNejc Habjan2021-12-301-45/+61
|
* chore: ensure reset_gitlab() succeedsJohn L. Villalovos2021-12-281-0/+30
| | | | | | | | | Ensure reset_gitlab() succeeds by waiting to make sure everything has been deleted as expected. If the timeout is exceeded fail the test. Not using `wait_for_sidekiq` as it didn't work. During testing I didn't see any sidekiq processes as being busy even though not everything was deleted.
* Merge pull request #1782 from python-gitlab/jlvillal/repository_func_testsNejc Habjan2021-12-281-0/+4
|\ | | | | chore: skip a functional test if not using >= py3.9
| * chore: skip a functional test if not using >= py3.9jlvillal/repository_func_testsJohn L. Villalovos2021-12-261-0/+4
| | | | | | | | | | One of the tests requires Python 3.9 or higher to run. Mark the test to be skipped if running Python less than 3.9.