keyrings.codeartifact 2.1.0__tar.gz → 2.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/.github/workflows/release.yml +42 -12
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/PKG-INFO +20 -32
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/README.md +11 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings.codeartifact.egg-info/PKG-INFO +20 -32
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings.codeartifact.egg-info/SOURCES.txt +1 -0
- keyrings_codeartifact-2.1.2/keyrings.codeartifact.egg-info/requires.txt +10 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/pyproject.toml +3 -4
- keyrings_codeartifact-2.1.2/requirements.txt +2 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/tests/test_backend.py +5 -57
- keyrings_codeartifact-2.1.2/tests/test_keyring.py +63 -0
- keyrings_codeartifact-2.1.0/keyrings.codeartifact.egg-info/requires.txt +0 -10
- keyrings_codeartifact-2.1.0/requirements.txt +0 -2
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/.github/dependabot.yml +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/.gitignore +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/LICENSE +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings/__init__.py +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings/codeartifact.py +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings.codeartifact.egg-info/dependency_links.txt +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings.codeartifact.egg-info/entry_points.txt +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings.codeartifact.egg-info/top_level.txt +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/requirements-dev.txt +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/requirements-test.txt +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/setup.cfg +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/tests/__init__.py +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/tests/config/multiple_sections_no_default.cfg +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/tests/config/multiple_sections_with_default.cfg +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/tests/config/single_section.cfg +0 -0
- {keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/tests/test_config.py +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
# .github/workflows/release.yml
|
2
2
|
|
3
|
-
name:
|
3
|
+
name: 🏗️ Build & release package.
|
4
4
|
|
5
5
|
on: push
|
6
6
|
|
7
7
|
jobs:
|
8
8
|
build:
|
9
|
-
name: 📦 Build package.
|
9
|
+
name: 📦 Build and test package.
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
|
12
12
|
steps:
|
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
|
25
25
|
- name: 🔬 Execute all unit tests.
|
26
26
|
run: |
|
27
|
-
python3 -m pip install .[
|
27
|
+
python3 -m pip install .[test]
|
28
28
|
python3 -m pytest
|
29
29
|
|
30
30
|
- name: 🛠️ Build package and source distribution.
|
@@ -32,14 +32,14 @@ jobs:
|
|
32
32
|
python3 -m pip install --user build
|
33
33
|
python3 -m build
|
34
34
|
|
35
|
-
- name: 💾 Store the built package
|
35
|
+
- name: 💾 Store the built package artifacts.
|
36
36
|
uses: actions/upload-artifact@v4
|
37
37
|
with:
|
38
|
-
name: python-package-
|
38
|
+
name: python-package-artifacts
|
39
39
|
path: dist/
|
40
40
|
|
41
41
|
publish-to-testpypi:
|
42
|
-
name: 🚀 Publish
|
42
|
+
name: 🚀 Publish package to test PyPI index.
|
43
43
|
runs-on: ubuntu-latest
|
44
44
|
|
45
45
|
needs:
|
@@ -54,25 +54,26 @@ jobs:
|
|
54
54
|
id-token: write
|
55
55
|
|
56
56
|
steps:
|
57
|
-
- name: 📥 Download the built
|
57
|
+
- name: 📥 Download the built artifacts.
|
58
58
|
uses: actions/download-artifact@v4
|
59
59
|
with:
|
60
|
-
name: python-package-
|
60
|
+
name: python-package-artifacts
|
61
61
|
path: dist/
|
62
62
|
|
63
|
-
- name: 🚀 Publish
|
63
|
+
- name: 🚀 Publish package to TestPyPI.
|
64
64
|
uses: pypa/gh-action-pypi-publish@release/v1
|
65
65
|
with:
|
66
66
|
repository-url: https://test.pypi.org/legacy/
|
67
67
|
skip-existing: true
|
68
68
|
|
69
69
|
publish-to-pypi:
|
70
|
-
name: 🚀 Publish
|
70
|
+
name: 🚀 Publish package to main PyPI index.
|
71
71
|
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
72
72
|
runs-on: ubuntu-latest
|
73
73
|
|
74
74
|
needs:
|
75
75
|
- build
|
76
|
+
- publish-to-testpypi
|
76
77
|
|
77
78
|
environment:
|
78
79
|
name: pypi
|
@@ -83,11 +84,40 @@ jobs:
|
|
83
84
|
id-token: write
|
84
85
|
|
85
86
|
steps:
|
86
|
-
- name: 📥 Download the built
|
87
|
+
- name: 📥 Download the built artifacts.
|
87
88
|
uses: actions/download-artifact@v4
|
88
89
|
with:
|
89
|
-
name: python-package-
|
90
|
+
name: python-package-artifacts
|
90
91
|
path: dist/
|
91
92
|
|
92
93
|
- name: 🚀 Publish package to main PyPI index.
|
93
94
|
uses: pypa/gh-action-pypi-publish@release/v1
|
95
|
+
|
96
|
+
publish-github-release:
|
97
|
+
name: 🚀 Publish package to GitHub release.
|
98
|
+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
99
|
+
runs-on: ubuntu-latest
|
100
|
+
|
101
|
+
needs:
|
102
|
+
- build
|
103
|
+
|
104
|
+
permissions:
|
105
|
+
# IMPORTANT: mandatory for github release publishing
|
106
|
+
contents: write
|
107
|
+
|
108
|
+
steps:
|
109
|
+
- name: 📥 Download the built artifacts.
|
110
|
+
uses: actions/download-artifact@v4
|
111
|
+
with:
|
112
|
+
name: python-package-artifacts
|
113
|
+
path: dist/
|
114
|
+
|
115
|
+
- name: 🎁 Publish package to GitHub release.
|
116
|
+
env:
|
117
|
+
GITHUB_REPOSITORY: ${{ github.repository }}
|
118
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
119
|
+
TAG_NAME: ${{ github.ref_name }}
|
120
|
+
run: |
|
121
|
+
gh release create "${TAG_NAME}" --repo="${GITHUB_REPOSITORY}" \
|
122
|
+
--title="${TAG_NAME}" --generate-notes --verify-tag \
|
123
|
+
dist/*
|
@@ -1,50 +1,27 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: keyrings.codeartifact
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.2
|
4
4
|
Summary: Automatically retrieve credentials for AWS CodeArtifact.
|
5
5
|
Author-email: "Joshua M. Keyes" <joshua.michael.keyes@gmail.com>
|
6
|
-
License: MIT License
|
7
|
-
|
8
|
-
Copyright (c) 2022 Joshua M. Keyes <joshua.michael.keyes@gmail.com>
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
6
|
Project-URL: Homepage, https://github.com/jmkeyes/keyrings.codeartifact
|
29
7
|
Project-URL: Issues, https://github.com/jmkeyes/keyrings.codeartifact/issues
|
30
8
|
Project-URL: Repository, https://github.com/jmkeyes/keyrings.codeartifact.git
|
31
9
|
Keywords: aws,codeartifact,keyring
|
32
10
|
Classifier: Development Status :: 4 - Beta
|
33
11
|
Classifier: Intended Audience :: Developers
|
34
|
-
Classifier: License :: OSI Approved :: MIT License
|
35
12
|
Classifier: Programming Language :: Python :: 3
|
36
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
37
14
|
Requires-Python: >=3.9
|
38
15
|
Description-Content-Type: text/markdown
|
39
16
|
License-File: LICENSE
|
40
|
-
Requires-Dist: keyring~=25.
|
41
|
-
Requires-Dist: boto3~=1.
|
42
|
-
Provides-Extra:
|
43
|
-
Requires-Dist: flake8; extra == "
|
44
|
-
Requires-Dist: black; extra == "
|
45
|
-
Provides-Extra:
|
46
|
-
Requires-Dist: pytest>=6; extra == "
|
47
|
-
Requires-Dist: pytest-cov; extra == "
|
17
|
+
Requires-Dist: keyring~=25.6
|
18
|
+
Requires-Dist: boto3~=1.39
|
19
|
+
Provides-Extra: dev
|
20
|
+
Requires-Dist: flake8; extra == "dev"
|
21
|
+
Requires-Dist: black; extra == "dev"
|
22
|
+
Provides-Extra: test
|
23
|
+
Requires-Dist: pytest>=6; extra == "test"
|
24
|
+
Requires-Dist: pytest-cov; extra == "test"
|
48
25
|
Dynamic: license-file
|
49
26
|
|
50
27
|
AWS CodeArtifact Keyring Backend
|
@@ -138,3 +115,14 @@ profile_name=special_profile
|
|
138
115
|
[codeartifact account="999999999999" name="staging"]
|
139
116
|
profile_name=staging_profile
|
140
117
|
```
|
118
|
+
|
119
|
+
Development Environment
|
120
|
+
-----------------------
|
121
|
+
|
122
|
+
Use a virtual environment:
|
123
|
+
|
124
|
+
```
|
125
|
+
$ python3 -m venv venv
|
126
|
+
$ source venv/bin/activate
|
127
|
+
$ pip install -e .[dev,test]
|
128
|
+
```
|
@@ -89,3 +89,14 @@ profile_name=special_profile
|
|
89
89
|
[codeartifact account="999999999999" name="staging"]
|
90
90
|
profile_name=staging_profile
|
91
91
|
```
|
92
|
+
|
93
|
+
Development Environment
|
94
|
+
-----------------------
|
95
|
+
|
96
|
+
Use a virtual environment:
|
97
|
+
|
98
|
+
```
|
99
|
+
$ python3 -m venv venv
|
100
|
+
$ source venv/bin/activate
|
101
|
+
$ pip install -e .[dev,test]
|
102
|
+
```
|
{keyrings_codeartifact-2.1.0 → keyrings_codeartifact-2.1.2}/keyrings.codeartifact.egg-info/PKG-INFO
RENAMED
@@ -1,50 +1,27 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: keyrings.codeartifact
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.2
|
4
4
|
Summary: Automatically retrieve credentials for AWS CodeArtifact.
|
5
5
|
Author-email: "Joshua M. Keyes" <joshua.michael.keyes@gmail.com>
|
6
|
-
License: MIT License
|
7
|
-
|
8
|
-
Copyright (c) 2022 Joshua M. Keyes <joshua.michael.keyes@gmail.com>
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
6
|
Project-URL: Homepage, https://github.com/jmkeyes/keyrings.codeartifact
|
29
7
|
Project-URL: Issues, https://github.com/jmkeyes/keyrings.codeartifact/issues
|
30
8
|
Project-URL: Repository, https://github.com/jmkeyes/keyrings.codeartifact.git
|
31
9
|
Keywords: aws,codeartifact,keyring
|
32
10
|
Classifier: Development Status :: 4 - Beta
|
33
11
|
Classifier: Intended Audience :: Developers
|
34
|
-
Classifier: License :: OSI Approved :: MIT License
|
35
12
|
Classifier: Programming Language :: Python :: 3
|
36
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
37
14
|
Requires-Python: >=3.9
|
38
15
|
Description-Content-Type: text/markdown
|
39
16
|
License-File: LICENSE
|
40
|
-
Requires-Dist: keyring~=25.
|
41
|
-
Requires-Dist: boto3~=1.
|
42
|
-
Provides-Extra:
|
43
|
-
Requires-Dist: flake8; extra == "
|
44
|
-
Requires-Dist: black; extra == "
|
45
|
-
Provides-Extra:
|
46
|
-
Requires-Dist: pytest>=6; extra == "
|
47
|
-
Requires-Dist: pytest-cov; extra == "
|
17
|
+
Requires-Dist: keyring~=25.6
|
18
|
+
Requires-Dist: boto3~=1.39
|
19
|
+
Provides-Extra: dev
|
20
|
+
Requires-Dist: flake8; extra == "dev"
|
21
|
+
Requires-Dist: black; extra == "dev"
|
22
|
+
Provides-Extra: test
|
23
|
+
Requires-Dist: pytest>=6; extra == "test"
|
24
|
+
Requires-Dist: pytest-cov; extra == "test"
|
48
25
|
Dynamic: license-file
|
49
26
|
|
50
27
|
AWS CodeArtifact Keyring Backend
|
@@ -138,3 +115,14 @@ profile_name=special_profile
|
|
138
115
|
[codeartifact account="999999999999" name="staging"]
|
139
116
|
profile_name=staging_profile
|
140
117
|
```
|
118
|
+
|
119
|
+
Development Environment
|
120
|
+
-----------------------
|
121
|
+
|
122
|
+
Use a virtual environment:
|
123
|
+
|
124
|
+
```
|
125
|
+
$ python3 -m venv venv
|
126
|
+
$ source venv/bin/activate
|
127
|
+
$ pip install -e .[dev,test]
|
128
|
+
```
|
@@ -18,6 +18,7 @@ keyrings.codeartifact.egg-info/top_level.txt
|
|
18
18
|
tests/__init__.py
|
19
19
|
tests/test_backend.py
|
20
20
|
tests/test_config.py
|
21
|
+
tests/test_keyring.py
|
21
22
|
tests/config/multiple_sections_no_default.cfg
|
22
23
|
tests/config/multiple_sections_with_default.cfg
|
23
24
|
tests/config/single_section.cfg
|
@@ -10,7 +10,7 @@ name = "keyrings.codeartifact"
|
|
10
10
|
description = "Automatically retrieve credentials for AWS CodeArtifact."
|
11
11
|
dynamic = ["version", "dependencies", "optional-dependencies"]
|
12
12
|
keywords = ["aws", "codeartifact", "keyring"]
|
13
|
-
license =
|
13
|
+
license-files = [ "LICENSE" ]
|
14
14
|
requires-python = ">= 3.9"
|
15
15
|
readme = "README.md"
|
16
16
|
authors = [
|
@@ -19,7 +19,6 @@ authors = [
|
|
19
19
|
classifiers = [
|
20
20
|
"Development Status :: 4 - Beta",
|
21
21
|
"Intended Audience :: Developers",
|
22
|
-
"License :: OSI Approved :: MIT License",
|
23
22
|
"Programming Language :: Python :: 3",
|
24
23
|
"Programming Language :: Python :: 3 :: Only",
|
25
24
|
]
|
@@ -36,8 +35,8 @@ AWS-CodeArtifact = "keyrings.codeartifact"
|
|
36
35
|
file = ["requirements.txt"]
|
37
36
|
|
38
37
|
[tool.setuptools.dynamic.optional-dependencies]
|
39
|
-
|
40
|
-
|
38
|
+
dev = { file = ["requirements-dev.txt"] }
|
39
|
+
test = { file = ["requirements-test.txt"] }
|
41
40
|
|
42
41
|
[tool.setuptools_scm]
|
43
42
|
local_scheme = "no-local-version" # required for PyPI and TestPyPI
|
@@ -2,20 +2,17 @@
|
|
2
2
|
|
3
3
|
import pytest
|
4
4
|
|
5
|
-
import os
|
6
|
-
import boto3
|
7
|
-
import botocore.stub
|
8
|
-
|
9
|
-
import keyring
|
10
|
-
|
11
5
|
from io import StringIO
|
12
6
|
from pathlib import Path
|
13
7
|
from urllib.parse import urlunparse
|
14
8
|
from datetime import datetime, timedelta
|
15
9
|
|
10
|
+
from botocore.stub import Stubber
|
11
|
+
|
16
12
|
from contextlib import contextmanager
|
17
13
|
from tempfile import NamedTemporaryFile
|
18
14
|
|
15
|
+
from keyrings.codeartifact import make_codeartifact_client
|
19
16
|
from keyrings.codeartifact import CodeArtifactBackend, CodeArtifactKeyringConfig
|
20
17
|
|
21
18
|
REGION_NAME = "ca-central-1"
|
@@ -48,59 +45,10 @@ def config_from_string(content: str):
|
|
48
45
|
yield cfg
|
49
46
|
|
50
47
|
|
51
|
-
@pytest.fixture
|
52
|
-
def default_backend():
|
53
|
-
backend = CodeArtifactBackend()
|
54
|
-
original = keyring.get_keyring()
|
55
|
-
|
56
|
-
keyring.set_keyring(backend)
|
57
|
-
yield backend
|
58
|
-
keyring.set_keyring(original)
|
59
|
-
|
60
|
-
|
61
|
-
def test_set_password_raises(default_backend):
|
62
|
-
with pytest.raises(NotImplementedError):
|
63
|
-
keyring.set_password("service", "username", "password")
|
64
|
-
|
65
|
-
|
66
|
-
def test_delete_password_raises(default_backend):
|
67
|
-
with pytest.raises(NotImplementedError):
|
68
|
-
keyring.delete_password("service", "username")
|
69
|
-
|
70
|
-
|
71
|
-
@pytest.mark.parametrize(
|
72
|
-
"service",
|
73
|
-
[
|
74
|
-
"https://example.com/",
|
75
|
-
"https://unknown.amazonaws.com/",
|
76
|
-
codeartifact_url("domain", "owner", "region", "/maven/repo/"),
|
77
|
-
],
|
78
|
-
)
|
79
|
-
def test_get_credential_unsupported_host(default_backend, service):
|
80
|
-
assert not keyring.get_credential(service, None)
|
81
|
-
|
82
|
-
|
83
|
-
@pytest.mark.parametrize(
|
84
|
-
"service",
|
85
|
-
[
|
86
|
-
codeartifact_url("domain", "000000000000", "region", "/pkg"),
|
87
|
-
codeartifact_url("domain", "000000000000", "region", "/pypi/"),
|
88
|
-
codeartifact_url("domain", "000000000000", "region", "/pkg/simple/"),
|
89
|
-
],
|
90
|
-
)
|
91
|
-
def test_get_credential_invalid_path(default_backend, service):
|
92
|
-
assert not keyring.get_credential(service, None)
|
93
|
-
|
94
|
-
|
95
48
|
def test_get_credential_supported_host():
|
96
49
|
def make_client(options):
|
97
|
-
|
98
|
-
|
99
|
-
region_name=options.get("region_name"),
|
100
|
-
)
|
101
|
-
|
102
|
-
client = session.client("codeartifact", **options)
|
103
|
-
stubber = botocore.stub.Stubber(client)
|
50
|
+
client = make_codeartifact_client(options)
|
51
|
+
stubber = Stubber(client)
|
104
52
|
|
105
53
|
parameters = {
|
106
54
|
"domain": "domain",
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# test_keyring.py -- keyring tests
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import keyring
|
6
|
+
|
7
|
+
from urllib.parse import urlunparse
|
8
|
+
from datetime import datetime, timedelta
|
9
|
+
|
10
|
+
from keyrings.codeartifact import CodeArtifactBackend
|
11
|
+
|
12
|
+
|
13
|
+
def codeartifact_url(domain, owner, region, path):
|
14
|
+
netloc = f"{domain}-{owner}.d.codeartifact.{region}.amazonaws.com"
|
15
|
+
return urlunparse(("https", netloc, path, "", "", ""))
|
16
|
+
|
17
|
+
|
18
|
+
def codeartifact_pypi_url(domain, owner, region, name):
|
19
|
+
return codeartifact_url(domain, owner, region, f"/pypi/{name}/")
|
20
|
+
|
21
|
+
|
22
|
+
@pytest.fixture
|
23
|
+
def backend():
|
24
|
+
backend = CodeArtifactBackend()
|
25
|
+
original = keyring.get_keyring()
|
26
|
+
|
27
|
+
keyring.set_keyring(backend)
|
28
|
+
yield backend
|
29
|
+
keyring.set_keyring(original)
|
30
|
+
|
31
|
+
|
32
|
+
def test_set_password_raises(backend):
|
33
|
+
with pytest.raises(NotImplementedError):
|
34
|
+
keyring.set_password("service", "username", "password")
|
35
|
+
|
36
|
+
|
37
|
+
def test_delete_password_raises(backend):
|
38
|
+
with pytest.raises(NotImplementedError):
|
39
|
+
keyring.delete_password("service", "username")
|
40
|
+
|
41
|
+
|
42
|
+
@pytest.mark.parametrize(
|
43
|
+
"service",
|
44
|
+
[
|
45
|
+
"https://example.com/",
|
46
|
+
"https://unknown.amazonaws.com/",
|
47
|
+
codeartifact_url("domain", "owner", "region", "/maven/repo/"),
|
48
|
+
],
|
49
|
+
)
|
50
|
+
def test_get_credential_unsupported_host(backend, service):
|
51
|
+
assert not keyring.get_credential(service, None)
|
52
|
+
|
53
|
+
|
54
|
+
@pytest.mark.parametrize(
|
55
|
+
"service",
|
56
|
+
[
|
57
|
+
codeartifact_url("domain", "000000000000", "region", "/pkg"),
|
58
|
+
codeartifact_url("domain", "000000000000", "region", "/pypi/"),
|
59
|
+
codeartifact_url("domain", "000000000000", "region", "/pkg/simple/"),
|
60
|
+
],
|
61
|
+
)
|
62
|
+
def test_get_credential_invalid_path(backend, service):
|
63
|
+
assert not keyring.get_credential(service, None)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|