Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update securedrop-sdk to 0.0.8 #338

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ arrow = "*"
alembic = "*"
python-dateutil = "*"
sip = "*"
securedrop-sdk = ">=0.0.6"
securedrop-sdk = ">=0.0.8"
SQLALchemy = "*"

[dev-packages]
Expand Down
6 changes: 3 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions securedrop_client/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def authenticated(self):
Return a boolean indication that the connection to the API is
authenticated.
"""
return bool(self.api and self.api.token['token'])
return bool(self.api and self.api.token is not None)

def sync_api(self):
"""
Expand Down Expand Up @@ -727,7 +727,7 @@ def _on_reply_complete(self, result, current_object: Tuple[str, str]) -> None:
reply_db_object = db.Reply(
uuid=result.uuid,
source_id=source.id,
journalist_id=self.api.token['journalist_uuid'],
journalist_id=self.api.token_journalist_uuid,
filename=result.filename,
)
self.session.add(reply_db_object)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def test_Controller_authenticated_yes(homedir, config, mocker):
mock_session = mocker.MagicMock()
co = Controller('http://localhost', mock_gui, mock_session, homedir)
co.api = mocker.MagicMock()
co.api.token = {'token': 'foo'}
co.api.token = 'foo'
assert co.authenticated() is True


Expand All @@ -483,7 +483,7 @@ def test_Controller_authenticated_no(homedir, config, mocker):
mock_session = mocker.MagicMock()
co = Controller('http://localhost', mock_gui, mock_session, homedir)
co.api = mocker.MagicMock()
co.api.token = {'token': ''}
co.api.token = None
assert co.authenticated() is False


Expand Down Expand Up @@ -1304,7 +1304,7 @@ def test_Controller_on_reply_complete_success(homedir, mocker):
co = Controller('http://localhost', mock_gui, mock_session, homedir)
co.api = mocker.Mock()
journalist_uuid = 'abc123'
co.api.token = {'journalist_uuid': journalist_uuid}
co.api.token_journalist_uuid = journalist_uuid
mock_reply_succeeded = mocker.patch.object(co, 'reply_succeeded')
mock_reply_failed = mocker.patch.object(co, 'reply_failed')

Expand All @@ -1331,7 +1331,7 @@ def test_Controller_on_reply_complete_failure(homedir, mocker):
co = Controller('http://localhost', mock_gui, mock_session, homedir)
co.api = mocker.Mock()
journalist_uuid = 'abc123'
co.api.token = {'journalist_uuid': journalist_uuid}
co.api.token_journalist_uuid = journalist_uuid
mock_reply_succeeded = mocker.patch.object(co, 'reply_succeeded')
mock_reply_failed = mocker.patch.object(co, 'reply_failed')

Expand All @@ -1353,7 +1353,7 @@ def test_Controller_on_reply_timeout(homedir, mocker):
co = Controller('http://localhost', mock_gui, mock_session, homedir)
co.api = mocker.Mock()
journalist_uuid = 'abc123'
co.api.token = {'journalist_uuid': journalist_uuid}
co.api.token_journalist_uuid = journalist_uuid
mock_reply_succeeded = mocker.patch.object(co, 'reply_succeeded')
mock_reply_failed = mocker.patch.object(co, 'reply_failed')

Expand Down