Пример #1
0
   def testReadPubKeyCompr(self):
      #self.validInputStrings = [ \
         #'1CAGDKTRT1erLn2pHUQjZcUHuQvEyxGp3j',
         #'3HGSXsQN6CtM73E6QnPj6RPCKcQyXS4Sek',
         #'Lockbox[%s]' % self.lboxID,
         #'Lockbox[Bare:%s]' % self.lboxID,
         #binary_to_hex(self.pubKeyList[0]),
         #binary_to_hex(pubKeyCompr]   # a compressed key

      wltMap = {}
      lboxList = []

      scrInfo = getScriptForUserString(self.validInputStrings[5], wltMap, lboxList) 

      self.assertEqual(scrInfo['Script'], self.binScriptP2PKHCompr)
      self.assertEqual(scrInfo['WltID'], None)
      self.assertEqual(scrInfo['LboxID'], None)
      self.assertFalse(scrInfo['ShowID'])


      wltMap = {}
      wltMap[self.wlt.uniqueIDB58]  = self.wlt
      wltMap[self.wlt2.uniqueIDB58] = self.wlt2
      lboxList = [self.lbox]

      scrInfo = getScriptForUserString(self.validInputStrings[5], wltMap, lboxList) 

      self.assertEqual(scrInfo['Script'], self.binScriptP2PKHCompr)
      self.assertEqual(scrInfo['WltID'],  'BcDe2345y')
      self.assertEqual(scrInfo['LboxID'], None)
      self.assertFalse(scrInfo['ShowID'])
Пример #2
0
   def testReadBadStrings(self):

      wltMap = {}
      lboxList = []

      for badStr in self.badInputStrings:
         scrInfo = getScriptForUserString(badStr, wltMap, lboxList) 

         self.assertEqual(scrInfo['Script'], None)
         self.assertEqual(scrInfo['WltID'], None)
         self.assertEqual(scrInfo['LboxID'], None)


      wltMap = {}
      wltMap[self.wlt.uniqueIDB58]  = self.wlt
      wltMap[self.wlt2.uniqueIDB58] = self.wlt2
      lboxList = [self.lbox]

      for badStr in self.badInputStrings:
         scrInfo = getScriptForUserString(badStr, wltMap, lboxList) 

         self.assertEqual(scrInfo['Script'], None)
         self.assertEqual(scrInfo['WltID'], None)
         self.assertEqual(scrInfo['LboxID'], None)

# Running tests with "python <module name>" will NOT work for any Armory tests
# You must run tests with "python -m unittest <module name>" or run all tests with "python -m unittest discover"
# if __name__ == "__main__":
#    unittest.main()
Пример #3
0
   def testReadP2SH(self):

      wltMap = {}
      lboxList = []

      scrInfo = getScriptForUserString(self.validInputStrings[1], wltMap, lboxList) 

      self.assertEqual(scrInfo['Script'], self.binScriptP2SH_MS)
      self.assertEqual(scrInfo['WltID'], None)
      self.assertEqual(scrInfo['LboxID'], None)
      self.assertTrue(scrInfo['ShowID'])


      wltMap = {}
      wltMap[self.wlt.uniqueIDB58]  = self.wlt
      wltMap[self.wlt2.uniqueIDB58] = self.wlt2
      lboxList = [self.lbox]

      scrInfo = getScriptForUserString(self.validInputStrings[1], wltMap, lboxList) 

      self.assertEqual(scrInfo['Script'], self.binScriptP2SH_MS)
      self.assertEqual(scrInfo['WltID'],  None)
      self.assertEqual(scrInfo['LboxID'], self.lboxID)
      self.assertTrue(scrInfo['ShowID'])