Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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')
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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')
Exemplo n.º 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")