def sample1(self): lclVault = Vault() lclRecover = BasicRecovery() lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclpwd3 = PasswordTuple("LinkedIn", "P324") lclpwd4 = PasswordTuple("Quora", "hjkhkg34") lclPasswordList1 = PasswordList([]) lclPasswordList1.append(lclpwd1) lclPasswordList1.append(lclpwd2) lclGen = BasicLabelledKeyGenerator() lclKey = lclGen.generate(lclPasswordList1, lclpwd3) lclVault.append(lclKey) lclPasswordList2 = copy.copy(lclPasswordList1) lclKey2 = lclGen.generate(lclPasswordList2, lclpwd4) lclVault.append(lclKey2) lclRecoveredList1 = lclVault.recover(lclPasswordList1) # lclRecover.recoverList(lclVault, lclPasswordList1) print(lclRecoveredList1.toString()) lclPasswordList1.popByIdentifier("Facebook") lclRecoveredList2 = lclVault.recover(lclPasswordList1) # lclRecover.recoverList(lclVault, lclPasswordList1) print(lclRecoveredList2.toString())
def test_FullFunctionality(self): print("Running test Full Functionality in TestPasswordList") pwd1 = PasswordTuple("Facebook", "224") pwd2 = PasswordTuple("Google", "onion32") thelist = PasswordList() thelist.append(pwd1) thelist.append(pwd2) self.assertEqual(thelist.size(), 2)
def test_FullFunctionality(self): print("Running test Full Functionality in TestPasswordList") pwd1 = PasswordTuple("Facebook", "224") pwd2 = PasswordTuple("Google", "onion32") plist = PasswordList([]) plist.append(pwd1) plist.append(pwd2) assert(plist.popByIdentifier("Google").password() == "onion32")
def test_FullFunctionality(self): print("Running FullFunctionality test on TestBasicLabelledKeyGenerator.") lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclPasswordList = PasswordList([]) lclPasswordList.append(lclpwd1) lclPasswordList.append(lclpwd2) self.printAnEncoding(lclPasswordList, PasswordTuple("LinkedIn", "Stormy"))
def test_FullFunctionality(self): print("Running test FullFunctionality on TestMapFromInputToIntermediate.") lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclPasswordList = PasswordList([]) lclPasswordList.append(lclpwd1) lclPasswordList.append(lclpwd2) self.sample(lclPasswordList, 12894891324)
def test_createSampleKey(self): print("Running createSampleKey for BasicKeyTest.") lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclPasswordList = PasswordList([]) lclPasswordList.append(lclpwd1) lclPasswordList.append(lclpwd2) lclBasicKeyGenerator = BasicKeyGenerator() lclKey = lclBasicKeyGenerator.generateKey(lclPasswordList, "Grazzly") print(lclKey.encode())
def test_FullFunctionality(self): print("Running Full Functionality Test For TestCombinedMap.") lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclPasswordList = PasswordList([]) lclPasswordList.append(lclpwd1) lclPasswordList.append(lclpwd2) lclIntermediate = 0 lclResult = "Stormy" self.sample(lclPasswordList, lclIntermediate, lclResult)
def test_FullFunctionality(self): print("Running FullFunctionality for BasicKeyTest. ") lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclPasswordList = PasswordList([]) lclPasswordList.append(lclpwd1) lclPasswordList.append(lclpwd2) self.sampleCase(lclPasswordList, "") self.sampleCase(lclPasswordList, "Jeff Henry") self.sampleCase(lclPasswordList, "@@@@@@@@@@@@@@@@@") self.sampleCase(lclPasswordList, "%@%@%^#&") self.sampleCase(lclPasswordList, "hg hg hg hg")
def sampleWrongInput1(self): lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclpwd3 = PasswordTuple("LinkedIn", "Stormy") lclpwd4 = PasswordTuple("Dutch Oven", "Stsssormy") lclPasswordList1 = PasswordList([]) lclPasswordList1.append(lclpwd1) lclPasswordList1.append(lclpwd2) lclKey = self.gen.generate(lclPasswordList1, lclpwd4) lclPasswordList1.popByIdentifier(lclpwd1) lclResult = lclKey.compute(lclPasswordList1) print(lclResult) self.assertEqual(lclResult, -1)
def test_FullFunctionality(self): print("Running test_FullFunctionality test on test_SimpleKeyGenerator.") self.gen = SimpleKeyGenerator() lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclPasswordList1 = PasswordList([]) lclPasswordList1.append(lclpwd1) lclPasswordList1.append(lclpwd2) #self.tryCombo(lclPasswordList1, PasswordTuple("LinkedIn", "Stormy")) #self.tryCombo(lclPasswordList1, PasswordTuple("Dutch Oven", "Stsssormy")) #self.tryCombo(lclPasswordList1, PasswordTuple("", "Sdsdsdtormy")) #self.tryCombo(lclPasswordList1, PasswordTuple("", "Sdsdsdtormy")) self.tryCombo(lclPasswordList1, "Stormy") self.tryCombo(lclPasswordList1, "Dutch Oven") self.tryCombo(lclPasswordList1, "Sdsdsdtormy") self.tryCombo(lclPasswordList1, "")
def subtest1(self): lclGen = BasicLabelledKeyGenerator() lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclpwd3 = PasswordTuple("LinkedIn", "P324") lclPasswordList = PasswordList([]) lclPasswordList.append(lclpwd1) lclPasswordList.append(lclpwd2) lclKey = lclGen.generate(lclPasswordList, lclpwd3) #lclpwd4 = PasswordTuple("Quora", "Pdd324") #lclPasswordList.append(lclpwd4) lclComputed = lclKey.computeReturnTuple(lclPasswordList) print("Printed Map.") print(lclComputed.toString()) self.assertEqual(lclComputed.password(), lclpwd3.password())
def test_getCopy(self): print("Running test_getCopy in TestPasswordList") pwd1 = PasswordTuple("Facebook", "224") pwd2 = PasswordTuple("Google", "onion32") pwd3 = PasswordTuple("LinkedIn", "ddonion32") pwd4 = PasswordTuple("Quora", "onion32324") print(pwd1.toString()) print(pwd2.toString()) qlist = PasswordList() print(qlist.toString()) qlist.append(pwd1) print(qlist.toString()) qlist.append(pwd2) print(qlist.toString()) print(qlist.getCopy().toString()) qlist.popByIdentifier("Facebook") print(qlist.toString()) qlist.popByIdentifier("Google") print(qlist.toString())
def test_FullTest(self): print("Running FullTest on testSimpleLabelledKeyGenerator.") self.gen = SimpleLabelledKeyGenerator() lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclpwd3 = PasswordTuple("LinkedIn", "Stormy") lclpwd4 = PasswordTuple("Dutch Oven", "Stsssormy") lclpwd5 = PasswordTuple("", "Sdsdsdtormy") lclpwd6 = PasswordTuple("Lawrence's Password", "Sdsdsdtormy") lclPasswordList1 = PasswordList([]) lclPasswordList1.append(lclpwd1) lclPasswordList1.append(lclpwd2) self.tryBasicMapping(lclPasswordList1, lclpwd3) self.tryBasicMapping(lclPasswordList1, lclpwd4) self.tryBasicMapping(lclPasswordList1, lclpwd5) self.tryBasicMapping(lclPasswordList1, lclpwd6) self.sampleWrongInput1()
def sample1(self): lclVault = Vault() lclGen = BasicLabelledKeyGenerator() lclpwd1 = PasswordTuple("Facebook", "q234") lclpwd2 = PasswordTuple("Google", "778") lclpwd3 = PasswordTuple("LinkedIn", "P324") lclpwd4 = PasswordTuple("Quora", "hjkhkg34") lclPasswordList1 = PasswordList([]) lclPasswordList1.append(lclpwd1) lclPasswordList1.append(lclpwd2) lclPasswordList2 = PasswordList([]) lclPasswordList2.append(lclpwd1) lclPasswordList3 = PasswordList([]) lclPasswordList3.append(lclpwd4) lclKey1 = lclGen.generate(lclPasswordList1, lclpwd3) lclKey2 = lclGen.generate(lclPasswordList2, lclpwd4) lclVault.append(lclKey1) lclVault.append(lclKey2) print("Vault contents: ") print(lclVault.toString()) #assert(isinstance(lclKey2, BasicLabelledKey)) lclResultList1 = lclVault.recover(lclPasswordList2) lclResultList2 = lclVault.recover(lclPasswordList1) print("Recovery from Google Password: ") print(lclResultList1.toString())
class TestProgramStateSaving(unittest.TestCase): def test_MainFunctionality(self): print("Running the MainFunctionality test for the TestProgramStateSaving.") mainState = ProgramState() self.define() print("Variables defined.") print("1:" + mainState.vault.toString()) mainState.vault.addOutput(self.lclpwd6) print("2:" + mainState.vault.toString()) mainState.vault.addOutput(self.lclpwd5) print("3:" + mainState.vault.toString()) mainState.vault.addInputList(self.passwordListA1) print("4:" + mainState.vault.toString()) mainState.vault.addInputList(self.passwordListA2) print("5:" + mainState.vault.toString()) mainState.vault.addInputList(self.passwordListA3) print("6:" + mainState.vault.toString()) mainState.vault.addInputList(self.passwordListA4) print("7:" + mainState.vault.toString()) mainState.vault.removeOutput(self.lclpwd5) print("8:" + mainState.vault.toString()) mainState.vault.removeOutput(self.lclpwd2) print("9:" + mainState.vault.toString()) mainState.vault.removeInputList(self.passwordListA1) print("10:" + mainState.vault.toString()) mainState.vault.removeInputList(self.passwordListA1) print("11:" + mainState.vault.toString()) mainState.savePickledVault("LocalVault.vlt") def define(self): self.lclpwd1 = PasswordTuple("Facebook", "q234") self.lclpwd2 = PasswordTuple("Google", "778") self.lclpwd3 = PasswordTuple("LinkedIn", "P324") self.lclpwd4 = PasswordTuple("Quora", "hjkhkg34") self.lclpwd5 = PasswordTuple("Foursquare", "hjkhksssssg34") self.lclpwd6 = PasswordTuple("Dutch Oven", "hjkhsddkg34") self.passwordListA0 = PasswordList([]) self.passwordListA1 = PasswordList([]) self.passwordListA1.append(self.lclpwd1) self.passwordListA2 = PasswordList([]) self.passwordListA2.append(self.lclpwd1) self.passwordListA2.append(self.lclpwd2) self.passwordListA3 = PasswordList([]) self.passwordListA3.append(self.lclpwd1) self.passwordListA3.append(self.lclpwd2) self.passwordListA3.append(self.lclpwd3) self.passwordListA4 = PasswordList([]) self.passwordListA4.append(self.lclpwd1) self.passwordListA4.append(self.lclpwd2) self.passwordListA4.append(self.lclpwd3) self.passwordListA4.append(self.lclpwd4)