| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d72b378 commit 849301b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ docs/_build | |||
| 13 | 13 | .tox | |
| 14 | 14 | .venv/ | |
| 15 | 15 | venv/ | |
| 16 | + .mypy_cache/ | ||
| 16 | 17 | ||
| 17 | 18 | # Include tracked hidden files and directories in search and diff tools | |
| 18 | 19 | !.dockerignore | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,10 +27,19 @@ class VariableManager(CRUDMixin[Variable]): | |||
| 27 | 27 | _path = "/admin/ci/variables" | |
| 28 | 28 | _obj_cls = Variable | |
| 29 | 29 | _create_attrs = RequiredOptional( | |
| 30 | - required=("key", "value"), optional=("protected", "variable_type", "masked") | ||
| 30 | + required=("key", "value"), | ||
| 31 | + optional=("description", "masked", "protected", "raw", "variable_type"), | ||
| 31 | 32 | ) | |
| 32 | 33 | _update_attrs = RequiredOptional( | |
| 33 | - required=("key", "value"), optional=("protected", "variable_type", "masked") | ||
| 34 | + required=("key",), | ||
| 35 | + optional=( | ||
| 36 | + "description", | ||
| 37 | + "masked", | ||
| 38 | + "protected", | ||
| 39 | + "raw", | ||
| 40 | + "value", | ||
| 41 | + "variable_type", | ||
| 42 | + ), | ||
| 34 | 43 | ) | |
| 35 | 44 | ||
| 36 | 45 | ||
@@ -43,10 +52,28 @@ class GroupVariableManager(CRUDMixin[GroupVariable]): | |||
| 43 | 52 | _obj_cls = GroupVariable | |
| 44 | 53 | _from_parent_attrs = {"group_id": "id"} | |
| 45 | 54 | _create_attrs = RequiredOptional( | |
| 46 | - required=("key", "value"), optional=("protected", "variable_type", "masked") | ||
| 55 | + required=("key", "value"), | ||
| 56 | + optional=( | ||
| 57 | + "description", | ||
| 58 | + "environment_scope", | ||
| 59 | + "masked", | ||
| 60 | + "masked_and_hidden", | ||
| 61 | + "protected", | ||
| 62 | + "raw", | ||
| 63 | + "variable_type", | ||
| 64 | + ), | ||
| 47 | 65 | ) | |
| 48 | 66 | _update_attrs = RequiredOptional( | |
| 49 | - required=("key", "value"), optional=("protected", "variable_type", "masked") | ||
| 67 | + required=("key",), | ||
| 68 | + optional=( | ||
| 69 | + "description", | ||
| 70 | + "environment_scope", | ||
| 71 | + "masked", | ||
| 72 | + "protected", | ||
| 73 | + "raw", | ||
| 74 | + "value", | ||
| 75 | + "variable_type", | ||
| 76 | + ), | ||
| 50 | 77 | ) | |
| 51 | 78 | ||
| 52 | 79 | ||
@@ -60,9 +87,25 @@ class ProjectVariableManager(CRUDMixin[ProjectVariable]): | |||
| 60 | 87 | _from_parent_attrs = {"project_id": "id"} | |
| 61 | 88 | _create_attrs = RequiredOptional( | |
| 62 | 89 | required=("key", "value"), | |
| 63 | - optional=("protected", "variable_type", "masked", "environment_scope"), | ||
| 90 | + optional=( | ||
| 91 | + "description", | ||
| 92 | + "environment_scope", | ||
| 93 | + "masked", | ||
| 94 | + "masked_and_hidden", | ||
| 95 | + "protected", | ||
| 96 | + "raw", | ||
| 97 | + "variable_type", | ||
| 98 | + ), | ||
| 64 | 99 | ) | |
| 65 | 100 | _update_attrs = RequiredOptional( | |
| 66 | - required=("key", "value"), | ||
| 67 | - optional=("protected", "variable_type", "masked", "environment_scope"), | ||
| 101 | + required=("key",), | ||
| 102 | + optional=( | ||
| 103 | + "description", | ||
| 104 | + "environment_scope", | ||
| 105 | + "masked", | ||
| 106 | + "protected", | ||
| 107 | + "raw", | ||
| 108 | + "value", | ||
| 109 | + "variable_type", | ||
| 110 | + ), | ||
| 68 | 111 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,3 +43,39 @@ def test_project_variables(project): | |||
| 43 | 43 | assert variable.value == "new_value1" | |
| 44 | 44 | ||
| 45 | 45 | variable.delete() | |
| 46 | + | ||
| 47 | + | ||
| 48 | + def test_hidden_group_variables(group): | ||
| 49 | + variable = group.variables.create( | ||
| 50 | + {"key": "key1", "value": "secret_value", "masked_and_hidden": True} | ||
| 51 | + ) | ||
| 52 | + | ||
| 53 | + variable = group.variables.get(variable.key) | ||
| 54 | + assert variable.value is None | ||
| 55 | + assert variable.description is None | ||
| 56 | + assert variable in group.variables.list() | ||
| 57 | + | ||
| 58 | + variable.description = "new_description" | ||
| 59 | + variable.save() | ||
| 60 | + variable = group.variables.get(variable.key) | ||
| 61 | + assert variable.description == "new_description" | ||
| 62 | + | ||
| 63 | + variable.delete() | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + def test_hidden_project_variables(project): | ||
| 67 | + variable = project.variables.create( | ||
| 68 | + {"key": "key1", "value": "secret_value", "masked_and_hidden": True} | ||
| 69 | + ) | ||
| 70 | + | ||
| 71 | + variable = project.variables.get(variable.key) | ||
| 72 | + assert variable.value is None | ||
| 73 | + assert variable.description is None | ||
| 74 | + assert variable in project.variables.list() | ||
| 75 | + | ||
| 76 | + variable.description = "new_description" | ||
| 77 | + variable.save() | ||
| 78 | + variable = project.variables.get(variable.key) | ||
| 79 | + assert variable.description == "new_description" | ||
| 80 | + | ||
| 81 | + variable.delete() | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments