本文整理匯總了Python中Atomic.trust.Trust.add方法的典型用法代碼示例。如果您正苦於以下問題:Python Trust.add方法的具體用法?Python Trust.add怎麽用?Python Trust.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Atomic.trust.Trust
的用法示例。
在下文中一共展示了Trust.add方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TrustAdd
# 需要導入模塊: from Atomic.trust import Trust [as 別名]
# 或者: from Atomic.trust.Trust import add [as 別名]
def TrustAdd(self, registry, trusttype, pubkeys, keytype, sigstore, sigstoretype):
trust = Trust()
args = self.Args()
args.registry = registry
args.pubkeys = pubkeys
args.keytype = keytype
args.trust_type = trusttype
args.sigstoretype = sigstoretype
args.sigstore = sigstore
trust.set_args(args)
trust.add()
示例2: test_add_trust_keys
# 需要導入模塊: from Atomic.trust import Trust [as 別名]
# 或者: from Atomic.trust.Trust import add [as 別名]
def test_add_trust_keys(self):
args = self.Args()
args.sigstore = None
testobj = Trust(policy_filename = TEST_POLICY)
testobj.atomic_config = util.get_atomic_config(atomic_config = os.path.join(FIXTURE_DIR, "atomic.conf"))
testobj.set_args(args)
testobj.add()
with open(testobj.policy_filename, 'r') as f:
d = json.load(f)
self.assertEqual(d["transports"]["atomic"]["docker.io"][0]["keyPath"],
os.path.join(FIXTURE_DIR, "key1.pub"))
示例3: test_add_reject_type
# 需要導入模塊: from Atomic.trust import Trust [as 別名]
# 或者: from Atomic.trust.Trust import add [as 別名]
def test_add_reject_type(self):
args = self.Args()
args.trust_type = "reject"
args.sigstoretype = "web"
args.pubkeys = []
args.registry = "registry.example.com/foo"
testobj = Trust(policy_filename=TEST_POLICY)
testobj.atomic_config = util.get_atomic_config(atomic_config=os.path.join(FIXTURE_DIR, "atomic.conf"))
testobj.set_args(args)
testobj.add()
with open(testobj.policy_filename, "r") as f:
d = json.load(f)
self.assertEqual(d["transports"]["docker"][args.registry][0]["type"], args.trust_type)