コード例 #1
0
ファイル: models_ut.py プロジェクト: dqj/azure-iot-sdk-python
 def setUp(self):
     x509 = genmodels.X509Attestation(TEST_CERT1)
     self.gen_att = genmodels.AttestationMechanism(X509_LABEL, x509=x509)
     self.gen_twin = genmodels.InitialTwin()
     gen_eg = genmodels.EnrollmentGroup(TEST_REG_ID, self.gen_att, TEST_HOST_NAME, \
         self.gen_twin, TEST_ETAG, PROV_STATUS_ENABLED, TEST_TIME, TEST_TIME2)
     self.eg = EnrollmentGroup(gen_eg)
コード例 #2
0
ファイル: models_ut.py プロジェクト: dqj/azure-iot-sdk-python
 def test_eg_constructor_min_model(self):
     x509 = genmodels.X509Attestation()
     att = genmodels.AttestationMechanism(X509_LABEL, x509=x509)
     eg = genmodels.EnrollmentGroup(TEST_REG_ID, att)
     ret = EnrollmentGroup(eg)
     self.assertIsInstance(ret, EnrollmentGroup)
     self.assertIs(ret._internal, eg)
     self.assertIsInstance(ret._att_wrapper, AttestationMechanism)
     self.assertIs(ret._att_wrapper._internal, att)
     self.assertIsNone(ret._twin_wrapper)
コード例 #3
0
ファイル: models_ut.py プロジェクト: dqj/azure-iot-sdk-python
 def test_eg_constructor_full_model(self):
     x509 = genmodels.X509Attestation()
     att = genmodels.AttestationMechanism(X509_LABEL, x509=x509)
     twin = genmodels.InitialTwin()
     eg = genmodels.EnrollmentGroup(TEST_REG_ID, att, TEST_HOST_NAME, twin, TEST_ETAG, \
         PROV_STATUS_ENABLED, TEST_TIME, TEST_TIME2)
     ret = EnrollmentGroup(eg)
     self.assertIsInstance(ret, EnrollmentGroup)
     self.assertIs(ret._internal, eg)
     self.assertIsInstance(ret._att_wrapper, AttestationMechanism)
     self.assertIs(ret._att_wrapper._internal, att)
     self.assertIsInstance(ret._twin_wrapper, InitialTwin)
     self.assertIs(ret._twin_wrapper._internal, twin)
コード例 #4
0
    def create_with_x509_ca_refs(cls, ref1, ref2=None):
        """
        Create an AttestationMechanism using X509 CA References

        :param str ref1: Primary CA reference
        :param str ref2: Secondary CA reference (optional)
        :returns: New instance of :class:`AttestationMechnaism
         <provisioningserviceclient.models.AttestationMechanism>`
        :rtype: :class:`AttestationMechnaism<provisioningserviceclient.models.AttestationMechanism>`
        """
        ca_refs = genmodels.X509CAReferences(ref1, ref2)
        x509 = genmodels.X509Attestation(ca_references=ca_refs)
        att = genmodels.AttestationMechanism("x509", x509=x509)
        return cls(att)
コード例 #5
0
    def create_with_x509_signing_certs(cls, cert1, cert2=None):
        """
        Create an AttestationMechanism using X509 signing certificates

        :param str cert1: Primary signing certificate
        :param str cert2: Secondary signing certificate (optional)
        :returns: New instance of :class:`AttestationMechnaism
         <provisioningserviceclient.models.AttestationMechanism>`
        :rtype: :class:`AttestationMechnaism<provisioningserviceclient.models.AttestationMechanism>`
        """
        primary = genmodels.X509CertificateWithInfo(cert1)
        secondary = None
        if cert2:
            secondary = genmodels.X509CertificateWithInfo(cert2)
        certs = genmodels.X509Certificates(primary, secondary)
        x509 = genmodels.X509Attestation(signing_certificates=certs)
        att = genmodels.AttestationMechanism("x509", x509=x509)
        return cls(att)