예제 #1
0
 def test_select_entry(self):
     """Test password selection."""
     with TemporaryDirectory() as directory:
         touch(os.path.join(directory, 'foo.gpg'))
         touch(os.path.join(directory, 'bar.gpg'))
         touch(os.path.join(directory, 'baz.gpg'))
         program = PasswordStore(directory=directory)
         # Substring search.
         entry = program.select_entry('fo')
         assert entry.name == 'foo'
         # Fuzzy search.
         entry = program.select_entry('bz')
         assert entry.name == 'baz'
예제 #2
0
 def test_select_entry(self):
     """Test password selection."""
     with TemporaryDirectory() as directory:
         touch(os.path.join(directory, "foo.gpg"))
         touch(os.path.join(directory, "bar.gpg"))
         touch(os.path.join(directory, "baz.gpg"))
         program = PasswordStore(directory=directory)
         # Substring search.
         entry = program.select_entry("fo")
         assert entry.name == "foo"
         # Fuzzy search.
         entry = program.select_entry("bz")
         assert entry.name == "baz"
예제 #3
0
 def test_select_entry_interactive(self):
     """Test interactive password selection."""
     with TemporaryDirectory() as directory:
         touch(os.path.join(directory, 'foo.gpg'))
         touch(os.path.join(directory, 'bar.gpg'))
         touch(os.path.join(directory, 'baz.gpg'))
         # Select entries using the command line filter 'a' and then use
         # interactive selection to narrow the choice down to 'baz' by
         # specifying the unique substring 'z'.
         program = PasswordStore(directory=directory)
         with CaptureOutput(input='z'):
             entry = program.select_entry('a')
             assert entry.name == 'baz'