Пример #1
0
 def test_should_be_able_to_decrypt_an_entry_with_a_given_password(self):
     """Pass entry should be able to decrypt an entry with a given password."""
     pr = PassReader(path="tests/password-store-with-pass",
                     password="******")
     decrypted_entry = PassEntry.decrypt_entry(pr, "test1")
     entry = 'F_Yq^5vgeyMCgYf-tW\\!T7Uj|\n---\nurl: someurl.com\n'
     assert decrypted_entry == entry
Пример #2
0
 def test_should_correctly_parse_all_relevant_data(self):
     """Pass entry should correctly parse all relevant data."""
     entry = PassEntry(self.pr, "test1")
     assert entry.password == "somepassword"
     assert entry.url == "someurl.com"
     assert entry.user == "myusername"
     assert entry.notes == "some notes something interesting"
     assert entry.custom_properties["cell_number"] == "00000000"
Пример #3
0
 def test_should_raise_an_exception_when_trying_to_decrypt_absent_entries(
         self):
     """It should raise an exception when trying to decrypt absent entries"""
     with pytest.raises(EntryNotFoundException):
         PassEntry.decrypt_entry(self.pr, "")
     with pytest.raises(EntryNotFoundException):
         PassEntry.decrypt_entry(self.pr, None)
     with pytest.raises(FileNotFoundError):
         PassEntry.decrypt_entry(self.pr, "not_there")
Пример #4
0
 def custom_mapper(entry: PassEntry) -> PassEntry:
     entry.title += "_modified"
     if 'cell_number' in entry.custom_properties:
         entry.custom_properties["cell_number"] = "11111111"
     return entry
Пример #5
0
 def test_should_be_able_to_parse_a_valid_entry_line(self):
     """Pass entry should be able to parse a valid entry line."""
     assert PassEntry.parse_entry_line("some: valid line") == ("some",
                                                               "valid line")
Пример #6
0
 def test_should_be_able_to_recognize_a_valid_entry_line(self):
     """Pass entry should be able to recognize a valid entry line."""
     assert PassEntry.is_valid_line("some: valid line") is True
     assert PassEntry.is_valid_line("some NOT valid line") is False
Пример #7
0
 def test_should_be_able_to_decrypt_an_entry(self):
     """Pass entry should be able to decrypt an entry."""
     decrypted_entry = PassEntry.decrypt_entry(self.pr, "test1")
     entry = 'somepassword\n---\nurl: someurl.com\nuser: myusername\nnotes: some notes something ' \
             'interesting\ncell_number: 00000000\n'
     assert decrypted_entry == entry
Пример #8
0
 def test_should_correctly_parse_the_entry_name(self):
     """Pass entry should correctly parse the entry name."""
     assert PassEntry(self.pr, "test1").title == "test1"
     assert PassEntry(self.pr, "docs/test3").title == "test3"
     assert PassEntry(self.pr, "web/emails/test4").title == "test4"
Пример #9
0
 def test_should_correctly_parse_the_group(self):
     """Pass entry should correctly parse the group."""
     assert PassEntry(self.pr, "test1").groups == []
     assert PassEntry(self.pr, "docs/test3").groups == ["docs"]
     assert PassEntry(self.pr,
                      "web/emails/test4").groups == ["web", "emails"]