Exemple #1
0
 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()
Exemple #2
0
 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()
Exemple #3
0
 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"))
Exemple #4
0
 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"))
Exemple #5
0
 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)
Exemple #6
0
 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)