- Bugfixes for singular claim testing support.
This commit is contained in:
parent
0e21a2bd20
commit
836f30c26a
@ -148,6 +148,11 @@ class Claim(object):
|
|||||||
remark = "Exactly %i %s" % (n,atxt)
|
remark = "Exactly %i %s" % (n,atxt)
|
||||||
return remark + "."
|
return remark + "."
|
||||||
|
|
||||||
|
def triplet(self):
|
||||||
|
"""
|
||||||
|
Return protocol,role,label triplet
|
||||||
|
"""
|
||||||
|
return (self.protocol, self.role, self.shortlabel)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""
|
"""
|
||||||
|
@ -17,6 +17,7 @@ import tempfile
|
|||||||
""" Import scyther components """
|
""" Import scyther components """
|
||||||
import XMLReader
|
import XMLReader
|
||||||
import Error
|
import Error
|
||||||
|
import Claim
|
||||||
from Misc import *
|
from Misc import *
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@ -309,17 +310,19 @@ class Scyther(object):
|
|||||||
else:
|
else:
|
||||||
return self.output
|
return self.output
|
||||||
|
|
||||||
def verifyOne(self,claimid):
|
def verifyOne(self,cl):
|
||||||
"""
|
"""
|
||||||
Verify just a single claim with an ID retrieved from the
|
Verify just a single claim with an ID retrieved from the
|
||||||
procedure below, 'scanClaims'
|
procedure below, 'scanClaims', or a full claim object
|
||||||
"""
|
"""
|
||||||
return self.verify("--filter=%s" % claimid)
|
if isinstance(cl,Claim.Claim):
|
||||||
|
cl = cl.id
|
||||||
|
return self.verify("--filter=%s" % cl)
|
||||||
|
|
||||||
def scanClaims(self):
|
def scanClaims(self):
|
||||||
"""
|
"""
|
||||||
Retrieve the list of claims in a format that can be passed to
|
Retrieve the list of claims. Of each element (a claim), claim.id
|
||||||
--filter=X or 'verifyOne' later.
|
can be passed to --filter=X or 'verifyOne' later.
|
||||||
A result of 'None' means that some errors occurred.
|
A result of 'None' means that some errors occurred.
|
||||||
"""
|
"""
|
||||||
self.verify("--scan-claims")
|
self.verify("--scan-claims")
|
||||||
@ -327,10 +330,7 @@ class Scyther(object):
|
|||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
self.validxml = False # Signal that we should not interpret the output as XML
|
self.validxml = False # Signal that we should not interpret the output as XML
|
||||||
l = []
|
return self.claims
|
||||||
for claim in self.claims:
|
|
||||||
l.append(claim.id)
|
|
||||||
return l
|
|
||||||
|
|
||||||
def getClaim(self,claimid):
|
def getClaim(self,claimid):
|
||||||
if self.claims:
|
if self.claims:
|
||||||
|
Loading…
Reference in New Issue
Block a user