def test_equals_diff_the_same(self):
     left = DBEntry(path='/a/b',
                    title='testtitle',
                    user_name='test_username',
                    password_hash=DBEntry.create_password_hash('a', 'b'),
                    url='https://www.gmail.com',
                    notes='nnn')
     self.assertEqual(left, left)
 def test_from_lines_with_path_title_username(self):
     left = DBEntry(path='/a/b',
                    title='testtitle',
                    user_name='test_username')
     right = DBEntry.from_lines(
         left.path, ['Title: ' + left.title, 'UserName: ' + left.user_name],
         None)
     self.assertDBEntryEqual(left, right)
 def test_from_lines_empty_password(self):
     password = ''
     salt = 'abc'
     left = DBEntry(path='/a/b',
                    title='testtitle',
                    user_name='test_username',
                    password_hash=DBEntry.create_password_hash(
                        password, salt),
                    url='https://www.gmail.com',
                    notes='nnn')
     right = DBEntry.from_lines(left.path, [
         'Title: ' + left.title, 'UserName: '******'Password: '******'URL: ' + left.url, 'Notes: ' + left.notes
     ], salt)
     self.assertDBEntryEqual(left, right)
 def test_eq(self, first, second, same_parameters, expected):
     first_entry = DBEntry(first[0], first[1], first[2],
                           DBEntry.create_password_hash(first[3]), first[4],
                           first[5])
     second_entry = DBEntry(second[0], second[1], second[2],
                            DBEntry.create_password_hash(second[3]),
                            second[4], second[5])
     self.assertEqual(
         expected,
         first_entry.is_same(second_entry,
                             ignore_path=same_parameters[0],
                             ignore_title=same_parameters[1],
                             ignore_username=same_parameters[2],
                             ignore_password=same_parameters[3],
                             ignore_url=same_parameters[4],
                             ignore_notes=same_parameters[5]))
 def test_extract_value(self):
     self.assertEqual('abc', DBEntry.extract_value('', 'abc'))
 def test_from_lines_empty(self):
     left = DBEntry()
     right = DBEntry.from_lines(None, [], None)
     self.assertDBEntryEqual(left, right)
 def test_create_password_hash(self):
     self.assertEqual(
         'f9ab2ea533dcc96f57b0278ca4243eabef5f0bb3f21fa1bba64a70963da273ba523458bddbe602eb6bf'
         'b6329372ba038484596b00a4bbc8c6f92e72c04ced0dd',
         DBEntry.create_password_hash('a', 'b'))
 def test_extract_value_title_wrong_header(self):
     self.assertEqual(
         None, DBEntry.extract_value(DBEntry.TITLE, 'Title:testtitle'))
 def test_extract_value_title(self):
     self.assertEqual(
         'testtitle',
         DBEntry.extract_value(DBEntry.TITLE, 'Title: testtitle'))