Ejemplo n.º 1
0
 def checkan(acs, n):
     self.m.reset_mock()
     afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#',
                          ':', n, 'password', 4)
     afh.start()
     afh.save_accounts(acs)
     afh.end()
Ejemplo n.º 2
0
 def checkap(a, p):
     acopy = a[:]
     afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#',
                          ':', 5, 'password', 4)
     afh.start()
     afh.decrypt_account(acopy, p)
     afh.end()
     return acopy
Ejemplo n.º 3
0
        def checkl(ls):
            self.open_iter.reset_mock()
            self.open_iter.return_value = ls

            afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#',
                                 ':', 5, 'password', 4)
            afh.start()
            afh.load_accounts()
            afh.end()
Ejemplo n.º 4
0
 def checkver(ver):
     self.m.reset_mock()
     afh = AccFileHandler('prog', ver, 'filename', 'utf-8', '#', ':', 5,
                          'password', 4)
     afh.start()
     afh.save_accounts([])
     afh.end()
     out = self.ostream.mock_calls[0][1][0]
     return out
Ejemplo n.º 5
0
 def checka(acs):
     self.m.reset_mock()
     afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#',
                          ':', 3, 'password', 4)
     afh.start()
     afh.save_accounts(acs)
     afh.end()
     out = [i[1][0] for i in self.ostream.mock_calls]
     out = out[2:]  # remove comment
     return out
Ejemplo n.º 6
0
    def test_incorrect_decrypt_field_quantity(self):

        afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#', ':',
                             5, 'password', 4)
        afh.start()
        self.assertRaises(IndexError, afh.decrypt_account,
                          ['a', 'b', 'c', 'd'], 'password')
        afh.end()
Ejemplo n.º 7
0
    def test_file_isnt_a_file(self):
        self.m1.isfile.reset_mock()
        self.m1.isfile.return_value = False

        afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#', ':',
                             5, 'password', 4)
        afh.start()
        self.assertRaises(AccFileNotFileError, afh.load_accounts)
        afh.end()
Ejemplo n.º 8
0
 def checkf(n):
     afh = AccFileHandler('prog', 'version', 'filename', 'utf-8', '#',
                          ':', n, 'password', 4)
     afh.start()
     afh.end()