예제 #1
0
    def test_load_generate(self, genkey_mock, open_mock):
        open_mock.side_effect = IOError()
        kf = KeyFile('asdf.txt')
        kf._KeyFile__load_key()

        open_mock.assert_called_once_with('asdf.txt', 'rb')
        genkey_mock.assert_called_once_with()
예제 #2
0
    def test_load_key_exists(self, genkey_mock, validate_mock, open_mock):
        kf = KeyFile('asdf.txt')
        kf._KeyFile__load_key()

        assert kf._KeyFile__key == b'x' * 32
        open_mock.assert_called_once_with('asdf.txt', 'rb')
        validate_mock.assert_called_once_with()
        genkey_mock.assert_not_called()