2 files changed
@@ -35,6 +35,11 @@ def test_markdown(gl): | |||
| 35 | 35 | assert "foo" in html | |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | + def test_markdown_in_project(gl, project): | ||
| 39 | + html = gl.markdown("foo", project=project.path_with_namespace) | ||
| 40 | + assert "foo" in html | ||
| 41 | + | ||
| 42 | + | ||
| 38 | 43 | def test_lint(gl): | |
| 39 | 44 | success, errors = gl.lint("Invalid") | |
| 40 | 45 | assert success is False | |
@@ -127,6 +132,11 @@ def test_notification_settings(gl): | |||
| 127 | 132 | assert settings.level == gitlab.const.NOTIFICATION_LEVEL_WATCH | |
| 128 | 133 | ||
| 129 | 134 | ||
| 135 | + def test_search(gl): | ||
| 136 | + result = gl.search(scope=gitlab.const.SEARCH_SCOPE_USERS, search="Administrator") | ||
| 137 | + assert result[0]["id"] == 1 | ||
| 138 | + | ||
| 139 | + | ||
| 130 | 140 | def test_user_activities(gl): | |
| 131 | 141 | activities = gl.user_activities.list(query_parameters={"from": "2019-01-01"}) | |
| 132 | 142 | assert isinstance(activities, list) | |
@@ -237,3 +247,8 @@ def test_list_as_list_false_warnings(gl): | |||
| 237 | 247 | for warning in caught_warnings: | |
| 238 | 248 | assert isinstance(warning.message, DeprecationWarning) | |
| 239 | 249 | assert len(list(items)) > 20 | |
| 250 | + | ||
| 251 | + | ||
| 252 | + def test_list_with_as_list_and_iterator_raises(gl): | ||
| 253 | + with pytest.raises(ValueError, match="`as_list` or `iterator`"): | ||
| 254 | + gl.gitlabciymls.list(as_list=False, iterator=True) | ||
@@ -17,8 +17,10 @@ | |||
| 17 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 18 | 18 | ||
| 19 | 19 | import copy | |
| 20 | + import logging | ||
| 20 | 21 | import pickle | |
| 21 | 22 | import warnings | |
| 23 | + from http.client import HTTPConnection | ||
| 22 | 24 | ||
| 23 | 25 | import pytest | |
| 24 | 26 | import responses | |
@@ -100,6 +102,14 @@ def test_gitlab_as_context_manager(): | |||
| 100 | 102 | assert isinstance(gl, gitlab.Gitlab) | |
| 101 | 103 | ||
| 102 | 104 | ||
| 105 | + def test_gitlab_enable_debug(gl): | ||
| 106 | + gl.enable_debug() | ||
| 107 | + | ||
| 108 | + logger = logging.getLogger("requests.packages.urllib3") | ||
| 109 | + assert logger.level == logging.DEBUG | ||
| 110 | + assert HTTPConnection.debuglevel == 1 | ||
| 111 | + | ||
| 112 | + | ||
| 103 | 113 | @responses.activate | |
| 104 | 114 | @pytest.mark.parametrize( | |
| 105 | 115 | "status_code,response_json,expected", | |
@@ -143,6 +153,20 @@ def test_gitlab_get_license(gl, response_json, expected): | |||
| 143 | 153 | assert gitlab_license == expected | |
| 144 | 154 | ||
| 145 | 155 | ||
| 156 | + @responses.activate | ||
| 157 | + def test_gitlab_set_license(gl): | ||
| 158 | + responses.add( | ||
| 159 | + method=responses.POST, | ||
| 160 | + url="http://localhost/api/v4/license", | ||
| 161 | + json={"id": 1, "plan": "premium"}, | ||
| 162 | + status=201, | ||
| 163 | + match=helpers.MATCH_EMPTY_QUERY_PARAMS, | ||
| 164 | + ) | ||
| 165 | + | ||
| 166 | + gitlab_license = gl.set_license("yJkYXRhIjoiMHM5Q") | ||
| 167 | + assert gitlab_license["plan"] == "premium" | ||
| 168 | + | ||
| 169 | + | ||
| 146 | 170 | @responses.activate | |
| 147 | 171 | def test_gitlab_build_list(gl, resp_page_1, resp_page_2): | |
| 148 | 172 | responses.add(**resp_page_1) | |
0 commit comments