11# Unit tests for some chartpress methods
22from os import mkdir
33
4+ import git
45import pytest
56from ruamel .yaml import YAML
67
@@ -410,7 +411,7 @@ def test_publish_pages_firsttime(git_repo_mainonly, record_check_call):
410411 chartpress .publish_pages (
411412 "testchart" ,
412413 "1.2.3" ,
413- "jupyterhub/chartpress" ,
414+ "https://github.com/ jupyterhub/chartpress" ,
414415 "https://example.org/chartpress" ,
415416 "<foo>" ,
416417 push = False ,
@@ -423,7 +424,7 @@ def test_publish_pages_firsttime(git_repo_mainonly, record_check_call):
423424 "git" ,
424425 "clone" ,
425426 "--no-checkout" ,
426- "git@ github.com: jupyterhub/chartpress" ,
427+ "https:// github.com/ jupyterhub/chartpress" ,
427428 "testchart-1.2.3" ,
428429 ],
429430 {"echo" : True },
@@ -477,11 +478,30 @@ def test_publish_pages_firsttime(git_repo_mainonly, record_check_call):
477478 )
478479
479480 with open ("testchart-1.2.3/index.yaml" ) as f :
480- chart = YAML ().load (f )
481+ chart = YAML (typ = "safe" ).load (f )
482+
483+ chart ["entries" ]["testchart" ][0 ]["created" ] = "DATETIME"
484+ chart ["entries" ]["testchart" ][0 ]["digest" ] = "DIGEST"
485+ chart ["generated" ] = "DATETIME"
486+
487+ assert chart == {
488+ "apiVersion" : "v1" ,
489+ "entries" : {
490+ "testchart" : [
491+ {
492+ "apiVersion" : "v1" ,
493+ "created" : "DATETIME" ,
494+ "digest" : "DIGEST" ,
495+ "name" : "testchart" ,
496+ "urls" : [
497+ "https://example.org/chartpress/testchart-0.0.1-test.reset.version.tgz"
498+ ],
499+ "version" : "0.0.1-test.reset.version" ,
500+ }
501+ ]
502+ },
503+ "generated" : "DATETIME" ,
504+ }
481505
482- assert len (chart ["entries" ]) == 1
483- assert len (chart ["entries" ]["testchart" ]) == 1
484- assert chart ["entries" ]["testchart" ][0 ]["urls" ] == [
485- "https://example.org/chartpress/testchart-0.0.1-test.reset.version.tgz"
486- ]
487- assert chart ["entries" ]["testchart" ][0 ]["version" ] == "0.0.1-test.reset.version"
506+ r = git .Repo ("./testchart-1.2.3" )
507+ assert sorted (b .name for b in r .branches ) == ["gh-pages" , "main" ]
0 commit comments