@@ -530,11 +530,21 @@ def test_get_all_credentials_credstore_only(self):
530
530
'Password' : 'izayoi' ,
531
531
'ServerAddress' : 'https://gensokyo.jp/v2' ,
532
532
},
533
+ 'gensokyo.jp' : {
534
+ 'Username' : 'sakuya' ,
535
+ 'Password' : 'izayoi' ,
536
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
537
+ },
533
538
'https://default.com/v2' : {
534
539
'Username' : 'user' ,
535
540
'Password' : 'hunter2' ,
536
541
'ServerAddress' : 'https://default.com/v2' ,
537
542
},
543
+ 'default.com' : {
544
+ 'Username' : 'user' ,
545
+ 'Password' : 'hunter2' ,
546
+ 'ServerAddress' : 'https://default.com/v2' ,
547
+ },
538
548
}
539
549
540
550
def test_get_all_credentials_with_empty_credhelper (self ):
@@ -548,11 +558,21 @@ def test_get_all_credentials_with_empty_credhelper(self):
548
558
'Password' : 'izayoi' ,
549
559
'ServerAddress' : 'https://gensokyo.jp/v2' ,
550
560
},
561
+ 'gensokyo.jp' : {
562
+ 'Username' : 'sakuya' ,
563
+ 'Password' : 'izayoi' ,
564
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
565
+ },
551
566
'https://default.com/v2' : {
552
567
'Username' : 'user' ,
553
568
'Password' : 'hunter2' ,
554
569
'ServerAddress' : 'https://default.com/v2' ,
555
570
},
571
+ 'default.com' : {
572
+ 'Username' : 'user' ,
573
+ 'Password' : 'hunter2' ,
574
+ 'ServerAddress' : 'https://default.com/v2' ,
575
+ },
556
576
'registry1.io' : None ,
557
577
}
558
578
@@ -571,11 +591,21 @@ def test_get_all_credentials_with_credhelpers_only(self):
571
591
'Password' : 'izayoi' ,
572
592
'ServerAddress' : 'https://gensokyo.jp/v2' ,
573
593
},
594
+ 'gensokyo.jp' : {
595
+ 'Username' : 'sakuya' ,
596
+ 'Password' : 'izayoi' ,
597
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
598
+ },
574
599
'https://default.com/v2' : {
575
600
'Username' : 'user' ,
576
601
'Password' : 'hunter2' ,
577
602
'ServerAddress' : 'https://default.com/v2' ,
578
603
},
604
+ 'default.com' : {
605
+ 'Username' : 'user' ,
606
+ 'Password' : 'hunter2' ,
607
+ 'ServerAddress' : 'https://default.com/v2' ,
608
+ },
579
609
}
580
610
581
611
def test_get_all_credentials_with_auths_entries (self ):
@@ -591,18 +621,84 @@ def test_get_all_credentials_with_auths_entries(self):
591
621
'Password' : 'izayoi' ,
592
622
'ServerAddress' : 'https://gensokyo.jp/v2' ,
593
623
},
624
+ 'gensokyo.jp' : {
625
+ 'Username' : 'sakuya' ,
626
+ 'Password' : 'izayoi' ,
627
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
628
+ },
594
629
'https://default.com/v2' : {
595
630
'Username' : 'user' ,
596
631
'Password' : 'hunter2' ,
597
632
'ServerAddress' : 'https://default.com/v2' ,
598
633
},
634
+ 'default.com' : {
635
+ 'Username' : 'user' ,
636
+ 'Password' : 'hunter2' ,
637
+ 'ServerAddress' : 'https://default.com/v2' ,
638
+ },
599
639
'registry1.io' : {
600
640
'ServerAddress' : 'registry1.io' ,
601
641
'Username' : 'reimu' ,
602
642
'Password' : 'hakurei' ,
603
643
},
604
644
}
605
645
646
+ def test_get_all_credentials_with_empty_auths_entry (self ):
647
+ self .authconfig .add_auth ('default.com' , {})
648
+
649
+ assert self .authconfig .get_all_credentials () == {
650
+ 'https://gensokyo.jp/v2' : {
651
+ 'Username' : 'sakuya' ,
652
+ 'Password' : 'izayoi' ,
653
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
654
+ },
655
+ 'gensokyo.jp' : {
656
+ 'Username' : 'sakuya' ,
657
+ 'Password' : 'izayoi' ,
658
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
659
+ },
660
+ 'https://default.com/v2' : {
661
+ 'Username' : 'user' ,
662
+ 'Password' : 'hunter2' ,
663
+ 'ServerAddress' : 'https://default.com/v2' ,
664
+ },
665
+ 'default.com' : {
666
+ 'Username' : 'user' ,
667
+ 'Password' : 'hunter2' ,
668
+ 'ServerAddress' : 'https://default.com/v2' ,
669
+ },
670
+ }
671
+
672
+ def test_get_all_credentials_credstore_overrides_auth_entry (self ):
673
+ self .authconfig .add_auth ('default.com' , {
674
+ 'Username' : 'shouldnotsee' ,
675
+ 'Password' : 'thisentry' ,
676
+ 'ServerAddress' : 'https://default.com/v2' ,
677
+ })
678
+
679
+ assert self .authconfig .get_all_credentials () == {
680
+ 'https://gensokyo.jp/v2' : {
681
+ 'Username' : 'sakuya' ,
682
+ 'Password' : 'izayoi' ,
683
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
684
+ },
685
+ 'gensokyo.jp' : {
686
+ 'Username' : 'sakuya' ,
687
+ 'Password' : 'izayoi' ,
688
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
689
+ },
690
+ 'https://default.com/v2' : {
691
+ 'Username' : 'user' ,
692
+ 'Password' : 'hunter2' ,
693
+ 'ServerAddress' : 'https://default.com/v2' ,
694
+ },
695
+ 'default.com' : {
696
+ 'Username' : 'user' ,
697
+ 'Password' : 'hunter2' ,
698
+ 'ServerAddress' : 'https://default.com/v2' ,
699
+ },
700
+ }
701
+
606
702
def test_get_all_credentials_helpers_override_default (self ):
607
703
self .authconfig ['credHelpers' ] = {
608
704
'https://default.com/v2' : 'truesecret' ,
@@ -616,11 +712,21 @@ def test_get_all_credentials_helpers_override_default(self):
616
712
'Password' : 'izayoi' ,
617
713
'ServerAddress' : 'https://gensokyo.jp/v2' ,
618
714
},
715
+ 'gensokyo.jp' : {
716
+ 'Username' : 'sakuya' ,
717
+ 'Password' : 'izayoi' ,
718
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
719
+ },
619
720
'https://default.com/v2' : {
620
721
'Username' : 'reimu' ,
621
722
'Password' : 'hakurei' ,
622
723
'ServerAddress' : 'https://default.com/v2' ,
623
724
},
725
+ 'default.com' : {
726
+ 'Username' : 'reimu' ,
727
+ 'Password' : 'hakurei' ,
728
+ 'ServerAddress' : 'https://default.com/v2' ,
729
+ },
624
730
}
625
731
626
732
def test_get_all_credentials_3_sources (self ):
@@ -642,11 +748,21 @@ def test_get_all_credentials_3_sources(self):
642
748
'Password' : 'izayoi' ,
643
749
'ServerAddress' : 'https://gensokyo.jp/v2' ,
644
750
},
751
+ 'gensokyo.jp' : {
752
+ 'Username' : 'sakuya' ,
753
+ 'Password' : 'izayoi' ,
754
+ 'ServerAddress' : 'https://gensokyo.jp/v2' ,
755
+ },
645
756
'https://default.com/v2' : {
646
757
'Username' : 'user' ,
647
758
'Password' : 'hunter2' ,
648
759
'ServerAddress' : 'https://default.com/v2' ,
649
760
},
761
+ 'default.com' : {
762
+ 'Username' : 'user' ,
763
+ 'Password' : 'hunter2' ,
764
+ 'ServerAddress' : 'https://default.com/v2' ,
765
+ },
650
766
'registry1.io' : {
651
767
'ServerAddress' : 'registry1.io' ,
652
768
'Username' : 'reimu' ,
0 commit comments