-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_methods.py
30 lines (25 loc) · 982 Bytes
/
test_methods.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import docker_registry_client.manifest_utils as utils
import docker_registry_client.reposession as repo
__author__ = "Chris Stradtman"
__license__ = "MIT"
__version__ = "1.0"
def test_methods():
requestlist = [
{"repo": "mcr.microsoft.com", "repopath": "dotnet/core/sdk"},
{"repo": "index.docker.io", "repopath": "library/hello-world"}
]
for request in requestlist:
if "username" in request:
mysession = repo.RepoSession(
request["repo"], request["username"], request["password"])
else:
mysession = repo.RepoSession(request["repo"])
mysession.ConnectToRepository(request["repopath"])
taglist = mysession.GetTagList()
assert isinstance(taglist, list)
manifest = mysession.GetManifest('latest')
etag = utils.getManifestEtag(manifest)
assert isinstance(etag, str)
if __name__ == "__main__":
# execute only if run as a script
test_methods()