Skip to content

Commit

Permalink
Merge pull request #338 from rmol/sdk-0.0.8
Browse files Browse the repository at this point in the history
Update securedrop-sdk to 0.0.8
  • Loading branch information
redshiftzero authored Apr 30, 2019
2 parents 87f8c61 + 0ab4faa commit b7657e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
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

0 comments on commit b7657e9

Please sign in to comment.