Esempio n. 1
0
 def test_get_valid_property(self):
     storage = KeepassDatabase(self._display, self._database_details_valid)
     has_changed, actual_entry = storage.get(self._query_password.search,
                                             check_mode=False)
     self.assertFalse(has_changed)
     self.assertEqual(self._database_entry["password"],
                      actual_entry["password"])
     self._display.assert_has_calls([
         call.v("Keepass: database found - %s" %
                self._database_details_valid["location"]),
         call.vvv("Keepass: keyfile found - %s" %
                  self._database_details_valid["keyfile"]),
         call.v("Keepass: database opened - %s" %
                self._database_details_valid["location"]),
         call.vv("KeePass: entry found - %s" % self._query_password.search)
     ])
Esempio n. 2
0
 def test_get_valid_file(self):
     storage = KeepassDatabase(self._display, self._database_details_valid)
     has_changed, actual_entry = storage.get(self._query_file.search,
                                             check_mode=False)
     with open(self._database_details_valid["keyfile"], mode="rb") as file:
         self.assertFalse(has_changed)
         self.assertEqual(
             base64.b64encode(file.read()), actual_entry[os.path.basename(
                 self._database_details_valid["keyfile"])])
     self._display.assert_has_calls([
         call.v("Keepass: database found - %s" %
                self._database_details_valid["location"]),
         call.vvv("Keepass: keyfile found - %s" %
                  self._database_details_valid["keyfile"]),
         call.v("Keepass: database opened - %s" %
                self._database_details_valid["location"]),
         call.vv("KeePass: entry found - %s" % self._query_file.search),
         call.vv("KeePass: found property/file on entry - %s" %
                 self._query_file.search)
     ])