Beispiel #1
0
def main():
    search = SearchStore()
    listing = StoreListing(password_store_dir=PASSWORD_STORE_DIR)
    console = Console()
    config = Config(TPASS_CONFIG_FILE)
    app = App(config=config, search=search, listing=listing, console=console)
    app.run()
Beispiel #2
0
def app():
    return App(
        config={
            "shortcuts": {"1": "hello"},
            "commands": {"2": "world"},
            "settings": {
                "copy password to clipboard": True,
                "quit after opening password": False,
            },
        },
        search=SearchStore(),
        listing=StoreListing(TEST_PASSWORD_STORE_DIR),
        console=Console(),
    )
Beispiel #3
0
def test_set_search_term_selected_is_now__out_of_range():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.selected = 2
    listing.set_search_term("b")
    assert listing.selected == 1
Beispiel #4
0
def test_refresh_file_listing():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing._password_store_dir = REFRESH_TEST_PASSWORD_STORE_DIR
    listing.refresh_file_listing()
    assert listing.data == ["refresh"]
Beispiel #5
0
def test_set_search_term():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.set_search_term("c")
    assert listing.data == ["c"]
Beispiel #6
0
def test_set_listing_empty_search_term():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    assert listing.data == ["1", "2", "a", "b/a", "b/b", "c"]
Beispiel #7
0
def test_set_selected_password():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.selected_password = "******"
    assert listing.selected == 4
Beispiel #8
0
def test_set_selected_password_is_not_in_listing():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    with pytest.raises(ValueError):
        listing.selected_password = "******"
Beispiel #9
0
def test_selected_password_no_listing():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.data = []
    assert listing.selected_password is None
Beispiel #10
0
def test_set_selected_index_above_number_of_store_listings():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.selected = 6
    assert listing.selected == 5
Beispiel #11
0
def test_set_selected_index_below_zero():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.selected = -2
    assert listing.selected == 0
Beispiel #12
0
def test_set_selected_index_with_incrementer():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    listing.selected += 3
    assert listing.selected == 3
Beispiel #13
0
def test_selected_index():
    listing = StoreListing(password_store_dir=TEST_PASSWORD_STORE_DIR)
    assert listing.selected == 0