Exemple #1
0
    def it_changes_password(self, data_source):
        data_source.authenticate.return_value = None
        data_source.set_password.return_value = None

        keychain = Keychain(data_source)
        keychain.unlock("password")
        keychain.set_password("foobar")

        data_source.set_password.assert_called_with("foobar")
Exemple #2
0
    def it_changes_password(self, data_source):
        data_source.authenticate.return_value = None
        data_source.set_password.return_value = None

        keychain = Keychain(data_source)
        keychain.unlock("password")
        keychain.set_password("foobar")

        data_source.set_password.assert_called_with("foobar")
Exemple #3
0
    def it_unlocks_the_keychain_with_the_right_password(self, data_source):
        keychain = Keychain(data_source)
        keychain.unlock('rightpassword')

        data_source.authenticate.assert_called_with('rightpassword')
Exemple #4
0
    def it_throws_if_unlocking_uninitialized_keychain(self, data_source):
        data_source.is_initialised.return_value = False
        keychain = Keychain(data_source)

        keychain.unlock("somepassword")
Exemple #5
0
    def it_throws_if_unlocking_with_incorrect_password(self, data_source):
        data_source.authenticate.side_effect = IncorrectPasswordException

        keychain = Keychain(data_source)
        keychain.unlock("wrongpassword")
Exemple #6
0
    def it_throws_if_unlocking_with_incorrect_password(self, data_source):
        data_source.authenticate.side_effect = IncorrectPasswordException

        keychain = Keychain(data_source)
        keychain.unlock("wrongpassword")
Exemple #7
0
    def it_unlocks_the_keychain_with_the_right_password(self, data_source):
        keychain = Keychain(data_source)
        keychain.unlock('rightpassword')

        data_source.authenticate.assert_called_with('rightpassword')
Exemple #8
0
    def it_throws_if_unlocking_uninitialized_keychain(self, data_source):
        data_source.is_initialised.return_value = False
        keychain = Keychain(data_source)

        keychain.unlock("somepassword")