コード例 #1
0
ファイル: test_model.py プロジェクト: F3DS/f3ds
 def testToUrlObjectNoFilesizeNoHash(self):
     'Test that we can make a UrlObject out of this Scan object with no filesize or hash.'
     url = 'http://www.gourmetcheese.com/jackofalltrades.aspx'
     type = 'local'
     malicious = False
     scan = Scan(self.owner, type, url, malicious, self.siginfo)
     expected = UrlObject(url, -1, nonce=self.owner.name)
     actual = scan.to_UrlObject()
     self.assertEqual(expected, actual)
コード例 #2
0
ファイル: test_model.py プロジェクト: F3DS/f3ds
 def testRepr(self):
     'Test that repr makes sense.'
     url = 'http://www.nachocheesy.net/bestcornchips.aspx'
     type = 'local'
     malicious = False
     scan = Scan(self.owner, type, url, malicious, self.siginfo)
     actual = scan.__repr__()
     expected = "Scan(id=None, %s, %s, %s, %s, %s, hash=None, peer=None, tainted=None)" % \
                (self.owner, type, url, malicious, self.siginfo)
     self.assertEqual(expected, actual)
コード例 #3
0
ファイル: test_model.py プロジェクト: F3DS/f3ds
 def testSafety(self):
     'Test that accessing safety property gives correct result.'
     url = 'http://www.bluecornchipfanatics.com/bestnachocheese.cgi'
     type = 'local'
     malicious = False
     scan = Scan(self.owner, type, url, malicious, self.siginfo)
     expected = Safety(True, malicious)
     actual = scan.safety
     self.assertEqual(expected, actual)
     scan.malicious = True
     self.assertNotEqual(expected, scan.safety)
コード例 #4
0
ファイル: test_model.py プロジェクト: F3DS/f3ds
 def testToUrlObject(self):
     'Test that we can make a UrlObject out of this Scan object.'
     url = 'http://www.gourmetcheese.com/jackofalltrades.aspx'
     type = 'local'
     malicious = False
     scan = Scan(self.owner, type, url, malicious, self.siginfo)
     scan.filesize = 35980
     scan.hash = 'ea46fc3db21ae'
     expected = UrlObject(url, 35980, nonce=self.owner.name, hash='ea46fc3db21ae')
     actual = scan.to_UrlObject()
     self.assertEqual(expected, actual)