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

Merge securedrop-sdk #1746

Merged
merged 333 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
333 commits
Select commit Hold shift + click to select a range
6ce8a6c
Use urljoin instead of string concat for urls
vivekanand1101 Oct 12, 2018
16ed223
Merge pull request #23 from vivekanand1101/add-urllib
kushaldas Oct 23, 2018
ee5bf7d
Merge pull request #24 from freedomofpress/release-0.0.2
kushaldas Oct 23, 2018
077cf88
Enable Replies to be instantiated using only a UUID
redshiftzero Oct 25, 2018
cf6da45
Merge pull request #32 from freedomofpress/add-uuid-only-reply-init
kushaldas Oct 26, 2018
d5eb08e
securedrop-sdk 0.0.3
redshiftzero Oct 26, 2018
b890cc9
Merge pull request #35 from freedomofpress/release-0.0.3
kushaldas Oct 26, 2018
a62583e
Fixes #37, get stderr text in our process in Qubes
kushaldas Nov 1, 2018
6aca77c
fix #30: changed incorrect error message when downloading a file that…
Oct 31, 2018
fc8a1d0
repling to source returns a reply object
heartsucker Nov 5, 2018
3d62925
updated test data
heartsucker Nov 5, 2018
8ea9b6b
Merge pull request #38 from freedomofpress/catch_stderr
redshiftzero Nov 5, 2018
2c13513
Merge pull request #42 from freedomofpress/parse-reply-uuid
redshiftzero Nov 8, 2018
e8b0c2f
Merge pull request #36 from yatsenko-julia/issue-30
redshiftzero Nov 9, 2018
1e1ffb6
Rename sd-journalist to sd-proxy
emkll Nov 10, 2018
7937996
Merge pull request #43 from freedomofpress/rename-sd-journalist
redshiftzero Nov 10, 2018
128583e
securedrop-sdk 0.0.4
redshiftzero Nov 10, 2018
2aa6cab
Merge pull request #44 from freedomofpress/release/0.0.4
redshiftzero Nov 10, 2018
d1af063
Update README with additional context
eloquence Nov 13, 2018
603cd26
Merge pull request #45 from freedomofpress/more-informative-readme
redshiftzero Nov 13, 2018
64ad7af
Pin library versions in Pipfile
emkll Nov 13, 2018
885d24d
Runs pipenv safety checks for dependencies in CI
Nov 13, 2018
6e39e90
Merge pull request #46 from freedomofpress/pin-pipfile-hashes
conorsch Nov 13, 2018
622fea0
added optional client side uuid selection for replies
heartsucker Jan 11, 2019
8e745bc
added test for reply with client side uuid
heartsucker Jan 11, 2019
659bbc2
make test for reply_source more accurate on checking return type
heartsucker Jan 11, 2019
9dffdac
Merge pull request #49 from freedomofpress/reply-uuid
kushaldas Jan 11, 2019
e0af13a
Updates to release 0.0.5
kushaldas Jan 14, 2019
6263542
Merge pull request #53 from freedomofpress/for_release_0.0.5
kushaldas Jan 15, 2019
72476f5
parse filename when posting reply
heartsucker Jan 21, 2019
69ca548
Merge pull request #54 from freedomofpress/reply-filename
kushaldas Jan 25, 2019
0b1fe9e
fix auth header to use "Token" and not "token"
heartsucker Jan 25, 2019
0b2de02
updated test cassettes for token fix
heartsucker Jan 25, 2019
84681fb
Merge pull request #56 from freedomofpress/auth-token
kushaldas Jan 25, 2019
990f163
Updates setup.py to 0.0.6 release
kushaldas Jan 25, 2019
b993e1b
Merge pull request #57 from freedomofpress/for_release_006
heartsucker Jan 25, 2019
1594b33
remove explict pins in the pipfile
heartsucker Jan 30, 2019
1c7c5a4
updated ci to use --keep-outdated flag
heartsucker Jan 28, 2019
fc9fa8c
added --keep-outdated not to readme
heartsucker Jan 28, 2019
6d074e6
updated makefile to not include pipenv invocation
heartsucker Jan 28, 2019
d29027b
added urllib3 to setup.py
heartsucker Jan 28, 2019
1cd85c6
Merge pull request #61 from freedomofpress/pipenv
redshiftzero Jan 30, 2019
04e524e
added flake8/mypy to dev dependencies
heartsucker Jan 31, 2019
0a5f518
added lint and type check make targts
heartsucker Jan 31, 2019
663f654
added mypy cache to gitignore
heartsucker Jan 31, 2019
c8686ed
added flake8/mypy config options
heartsucker Jan 31, 2019
15d42c8
renamed utils.py
heartsucker Jan 31, 2019
5ef77f5
added linting and type checking to ci
heartsucker Jan 31, 2019
bb88969
mostly fix type checking and linting
heartsucker Jan 31, 2019
19d2e65
Merge pull request #63 from freedomofpress/mypy-and-linting
heartsucker Feb 6, 2019
8e2c965
updated pipenv usage
heartsucker Feb 8, 2019
b6b14f2
update ci to prevent updating dependencies
heartsucker Feb 8, 2019
533806d
Merge pull request #65 from freedomofpress/pipenv-fix
redshiftzero Mar 18, 2019
837dafe
ci: add test job vs external API
redshiftzero Jan 25, 2019
e261a3f
tests: update server host
redshiftzero Jan 25, 2019
293a39e
test: update cassettes to point to 127.0.0.1
redshiftzero Jan 26, 2019
de2ce49
readme: add circle ci badge for master branch build status
redshiftzero Mar 18, 2019
0874869
Pipfile.lock: set yarl==1.2.0
redshiftzero Mar 18, 2019
41254db
ci: use new NUM_SOURCES env var
redshiftzero Mar 19, 2019
3157be8
test: rework test suite to pass vs external server container
redshiftzero Mar 18, 2019
6b5924c
Merge pull request #59 from redshiftzero/ci-sdk-api
redshiftzero Mar 20, 2019
7a72326
added changelog entries for 0.0.5 and 0.0.6
heartsucker Mar 25, 2019
cb7acd3
Merge pull request #68 from freedomofpress/changelog
redshiftzero Mar 26, 2019
98433b4
skip pipenv's locking mechanism in CI
heartsucker Apr 8, 2019
f59344d
use consistent make targest do ci matches dev
heartsucker Apr 8, 2019
a4764e3
Merge pull request #70 from freedomofpress/pipenv-ci
redshiftzero Apr 12, 2019
fa85ca2
doc: explain how to make a release and update on PyPI
redshiftzero Apr 12, 2019
219d72e
Update PyYAML to 5.1.
rmol Apr 12, 2019
3042770
Merge pull request #71 from freedomofpress/release-guide
kushaldas Apr 15, 2019
68e8b4d
clean up header for documentation root
heartsucker Apr 15, 2019
1ca0ea6
remove unused docs file
heartsucker Apr 15, 2019
ff5588d
sync docs to match current behavior
heartsucker Apr 15, 2019
3f3f452
better formatting of original text
heartsucker Apr 15, 2019
9b8c08a
updated dev docs
heartsucker Apr 15, 2019
814e157
Merge pull request #72 from freedomofpress/fix-52-pyyaml-cve
rmol Apr 15, 2019
4b49dd5
Merge pull request #73 from freedomofpress/dev-docs
kushaldas Apr 18, 2019
eb6ab0c
Updates the decorator to store keys with sorted order
kushaldas Apr 19, 2019
67af672
Updates tests with similar tests from test_api
kushaldas Apr 19, 2019
3d22f00
Fixes lint issue with exception handling
kushaldas Apr 19, 2019
71ab1a6
Merge pull request #75 from freedomofpress/fix_apiproxy
redshiftzero Apr 24, 2019
1217486
Adds docs on generating test data for APIProxy
kushaldas Apr 19, 2019
091583b
Revert API.authenticate return type to bool
rmol Apr 18, 2019
3d41b67
Resolve review comments
rmol Apr 29, 2019
afe172c
Also test authentication results in test_apiproxy.py
rmol Apr 29, 2019
b280382
Remove isort config file
rmol Apr 29, 2019
f80692a
Merge pull request #74 from freedomofpress/fix-authenticate
redshiftzero Apr 29, 2019
293d14a
Merge pull request #76 from freedomofpress/howto_apiproxy_test_data
heartsucker May 3, 2019
56be7a7
remove mutable global state from API class
heartsucker May 7, 2019
2d7c3a9
simplify handling of http and rpc calls
heartsucker May 7, 2019
14e6f83
added timeouts to requests
heartsucker May 7, 2019
60a51f9
added pytest-mock to dependencies
heartsucker May 13, 2019
51e931d
added tests for api/proxy timeouts
heartsucker May 13, 2019
7222223
Update CHANGELOG.md
sssoleileraaa May 13, 2019
24d3d43
Update setup.py
sssoleileraaa May 13, 2019
ab54d86
Create CONTRIBUTING.md
sssoleileraaa May 13, 2019
be45c03
Rename CONTRIBUTING.md to CODE_OF_CONDUCT.md
sssoleileraaa May 13, 2019
4b1345a
Update README.md
sssoleileraaa May 13, 2019
37e2438
docs: Centralize docs for discoverability, get rid of docs/ dir
redshiftzero May 13, 2019
52504f4
Merge pull request #83 from freedomofpress/creviera-patch-1
redshiftzero May 13, 2019
d7e62d6
docs: fix links in README
redshiftzero May 13, 2019
9e1ebdc
Fix README typos
sssoleileraaa May 14, 2019
ba4d8c0
Merge pull request #84 from freedomofpress/docs-fix-links
redshiftzero May 14, 2019
5309592
Merge pull request #85 from freedomofpress/creviera-patch-1
redshiftzero May 14, 2019
d134120
Fixes #51 supports logout endpoint
kushaldas Jun 6, 2019
880635d
Renames test_logout to test_zlogout
kushaldas Jun 10, 2019
73c164a
Merge pull request #88 from freedomofpress/logout
kushaldas Jun 11, 2019
bc1aef2
Getting ready for 0.0.10 release
kushaldas Jun 11, 2019
3e15294
Merge pull request #91 from freedomofpress/release_0010
kushaldas Jun 11, 2019
a5306e9
Updates tests and data file for first and last name
kushaldas Jun 13, 2019
1f4b02c
Merge pull request #92 from freedomofpress/names
kushaldas Jun 18, 2019
0b24623
Fixes #93 raises the TimeOutErrors properly
kushaldas Jun 19, 2019
7078759
Merge pull request #95 from freedomofpress/give_me_my_error_back
redshiftzero Jun 19, 2019
a1d41bd
expose ETag in submission/reply downloads, update tests
redshiftzero Jun 19, 2019
b78636f
Merge pull request #96 from freedomofpress/etags
redshiftzero Jun 20, 2019
a8c1e39
securedrop-sdk 0.0.11
redshiftzero Jun 21, 2019
c507fb4
Merge pull request #97 from freedomofpress/release/0.0.11
kushaldas Jun 24, 2019
4543ba0
ci: increase build timeout to 20 minutes
redshiftzero Jun 24, 2019
047f8c8
Merge pull request #99 from freedomofpress/ci-fix-timeout
conorsch Jun 25, 2019
de1a284
Update qrexec policy keyword characters
pierwill Aug 19, 2019
005e963
Bump server container timeout to 30m
eloquence Aug 23, 2019
d2a924b
Merge pull request #104 from freedomofpress/bump-ci-timeout
redshiftzero Aug 23, 2019
15de0b7
Edit docstrings for readability and clarity
pierwill Aug 22, 2019
3883cdb
Merge pull request #103 from pierwill/docstring-edits
redshiftzero Aug 27, 2019
6403d35
Merge pull request #102 from pierwill/fix-qrexec-keywords
redshiftzero Oct 17, 2019
98bc533
add journalist first and last name as attributes on API
redshiftzero Nov 5, 2019
aa461f1
test: first/last name on token endpoint response
redshiftzero Nov 9, 2019
d70e134
test: None is a singleton, not a type
redshiftzero Nov 9, 2019
5af0b20
Merge pull request #105 from freedomofpress/token-endpoint-journo-names
kushaldas Nov 11, 2019
c2ce000
Updates to 0.0.12 release
kushaldas Nov 12, 2019
68e25b1
Merge pull request #106 from freedomofpress/upgrade_to_0.0.12
kushaldas Nov 12, 2019
b252f71
test: regression coverage for #109 (timeouts treated as auth errors)
redshiftzero Feb 6, 2020
23c879a
app: improve error handling for responses from qrexec proxy
redshiftzero Feb 7, 2020
4497eae
app: pure refactor - perform exception handling in common function
redshiftzero Feb 7, 2020
42e49a1
app: add exception class for ConnectionError, TooManyRedirects
redshiftzero Feb 7, 2020
748adb6
app: make direct HTTP json request function consistent with qrexec
redshiftzero Feb 7, 2020
2f15ab1
test: regression coverage for bug #111 (KeyError due to filename)
redshiftzero Feb 11, 2020
1140d40
dev, ci: Remove pipenv
redshiftzero Feb 11, 2020
89af60b
Merge pull request #112 from freedomofpress/filename-key-regres
kushaldas Feb 12, 2020
5f79497
Updates to 0.0.13 release
kushaldas Feb 12, 2020
ddcecaa
Merge pull request #113 from freedomofpress/release/0.0.13
redshiftzero Feb 12, 2020
2f71915
doc: explain how to pip install into virtualenv
redshiftzero Mar 30, 2020
3f8e92f
Fixes #114 Uses timeout in the proxy
kushaldas Mar 30, 2020
eb4338e
To raise a proper reply error
kushaldas Mar 30, 2020
99ebc06
Updates test cases for logout test case
kushaldas Mar 30, 2020
ffe8205
Update PyYaml to 5.3.1
emkll Apr 7, 2020
8094659
Merge pull request #120 from freedomofpress/pyyaml-531
redshiftzero Apr 7, 2020
152f89d
securedrop-sdk 0.1.0
redshiftzero Apr 24, 2020
7b5c48c
Merge pull request #122 from freedomofpress/release/0.1.0
redshiftzero Apr 27, 2020
24dc1ea
Add black and isort checks
rmol Jun 4, 2020
a31be70
Apply black and isort
rmol Jun 16, 2020
177e78c
Add .git-blame-ignore-revs
rmol Jun 16, 2020
38b285d
Merge pull request #124 from freedomofpress/black-isort
kushaldas Jun 24, 2020
7648834
Fix miswording in list of unacceptable behavior
eloquence Aug 6, 2020
aa15037
Merge pull request #126 from freedomofpress/coc-updates-2020-08-06
emkll Aug 11, 2020
157effc
add journalist name to reply
Aug 6, 2020
75ef554
Merge pull request #125 from freedomofpress/add-journalist-name-to-reply
kushaldas Sep 3, 2020
c69d54c
securedrop-sdk 0.1.1
Sep 3, 2020
590926b
Updates README with better instructions for test data
kushaldas Aug 28, 2020
77620fc
update readme
Sep 1, 2020
d5a9044
Merge pull request #130 from freedomofpress/release/0.1.1
emkll Sep 8, 2020
5abc481
Fix is_read test per changes in SecureDrop 1.6.0
eloquence Oct 8, 2020
cc64e2c
updated urllib from 1.25.8 to 1.25.10
zenmonkeykstop Oct 4, 2020
9741be4
Fix TOTP retry logic, improve cassette handling, document
eloquence Oct 8, 2020
4643ec2
Fix incorrect path in docs, clarify location
eloquence Oct 9, 2020
e32d3e8
Merge pull request #135 from freedomofpress/fix-auth-setup
kushaldas Oct 13, 2020
3d2a5a8
Add support for /users endpoint
eloquence Oct 8, 2020
ce2257b
Add API proxy test
eloquence Oct 9, 2020
cafcdde
Remove Pipfile and Pipfile.lock
emkll Oct 13, 2020
59fb62e
support seen endpoint
Oct 7, 2020
f6168f8
Document that making RPC policy changes will cause tests to fail
eloquence Oct 13, 2020
b5a8904
Merge pull request #140 from freedomofpress/support-seen-endpoint
kushaldas Oct 19, 2020
54b5c63
Update README.md
sssoleileraaa Oct 14, 2020
eea7bd9
Merge pull request #139 from freedomofpress/creviera-patch-1
emkll Oct 19, 2020
17a94fa
get first unread test submission
Oct 21, 2020
aeccc5e
Merge pull request #146 from freedomofpress/fix-flaky-test
emkll Oct 21, 2020
d0b04a7
ci: run nightly job on default (main) branch
emkll Oct 21, 2020
9d7fb42
securedrop-sdk 0.2.0
Oct 21, 2020
a7a8fe2
Merge pull request #142 from freedomofpress/release/0.2.0
emkll Oct 21, 2020
947405e
update links and old references
Oct 21, 2020
cc5eea0
Merge pull request #143 from freedomofpress/update-readme
emkll Oct 26, 2020
edc2745
Move redundant code into shared test class
eloquence Nov 12, 2020
4ec68cc
Avoid use of unittest; reorder tests for reliability
eloquence Nov 20, 2020
9f3a1f0
Update cassettes, including naming of setup method
eloquence Dec 2, 2020
b36604d
black/isort reformatting
eloquence Dec 2, 2020
93fd9f7
Simplify proxy tests and regenerate cassettes
eloquence Dec 4, 2020
e43f835
Simplify proxy test setup; more useful error when proxy is AWOL
eloquence Dec 11, 2020
2a3e7e0
Further README clarifications for running proxy tests
eloquence Dec 11, 2020
3772d66
Update pip requirements
emkll Jan 8, 2021
15bc20a
Merge pull request #153 from freedomofpress/pip-updates-20200107
kushaldas Jan 21, 2021
2835689
Updates PyYAML to 5.4.1
emkll Mar 2, 2021
b1741a3
Replace local copy of Code of Conduct with centralized one
eloquence Apr 9, 2021
7c19aa7
Merge pull request #157 from freedomofpress/centralized-code-of-conduct
conorsch Apr 9, 2021
8ae3144
Update tests for obsolete flag-for-reply workflow
rmol Jun 17, 2021
db767ac
regenerate cassettes
rmol Jun 22, 2021
0b2b69b
Add delete_conversation
rmol Jun 2, 2021
de8741b
update changelog 0.3.0
Jul 27, 2021
72ce7bb
Merge pull request #161 from freedomofpress/release/0.3.0
rmol Jul 28, 2021
a055103
fix `require-hashes mode` error
Jul 30, 2021
616d120
update readme for quicker quick start instructions
Jul 30, 2021
461c52f
use latest pip-tools
Jul 30, 2021
fae22d7
Merge pull request #162 from freedomofpress/use-latest-pip-tools
zenmonkeykstop Jul 30, 2021
8c2175b
Merge pull request #163 from freedomofpress/update-readme
zenmonkeykstop Jul 30, 2021
488248b
pin requests to same version as used in the client
Aug 2, 2021
8299bd8
update dev dependencies and fix linter errors
Aug 2, 2021
372eb54
use venv target in CI
Aug 3, 2021
710b270
pin urllib3 to same version used in the client
Aug 3, 2021
4bd57fe
Adds upgrade-pip makefile target
kushaldas Aug 13, 2021
0b3b662
update requests and urllib3
Aug 25, 2021
ca68fd0
Merge pull request #166 from freedomofpress/address-urllib3-dependabo…
kushaldas Aug 26, 2021
867974d
update dev-only dependencies and sync with prod
Aug 27, 2021
94f3e17
Update dev requirements and prod .in file to match client spec
Aug 27, 2021
94ae43b
Merge pull request #167 from freedomofpress/support-dev-only-and-sync
kushaldas Aug 30, 2021
4958b3f
Release securedrop-sdk 0.3.1
Aug 30, 2021
b8e91d4
Merge pull request #168 from freedomofpress/release/0.3.1
zenmonkeykstop Aug 31, 2021
46f86dd
update to idna 3.2 and dev deps
Sep 10, 2021
8ccbb17
Merge pull request #169 from freedomofpress/update-idna
zenmonkeykstop Sep 13, 2021
563d635
release securedrop-sdk 0.3.2
Sep 13, 2021
9b70550
Merge pull request #170 from freedomofpress/release/0.3.2
zenmonkeykstop Sep 13, 2021
4a157df
Ensure support for common date string formats
gonzalo-bulnes Feb 9, 2022
a420618
Remove copyright and license notice...
gonzalo-bulnes Feb 21, 2022
7f0f820
update version and changelog for 0.4.0
Apr 6, 2022
31ea11e
Merge pull request #176 from freedomofpress/release/0.4.0
sssoleileraaa Apr 6, 2022
2ccc82b
Update reply and submission retrieval.
nahara7 Apr 26, 2022
20be47f
Update comment
nahara7 Apr 26, 2022
0909cb9
Merge pull request #174 from nahara7/nahara/sdk-objects
sssoleileraaa May 19, 2022
337421c
Bump certifi to 2022.12.7
legoktm Dec 16, 2022
d027bc5
Bump wheel to 0.38.4
legoktm Dec 16, 2022
50d365b
Update pytest to 7.2.0, drop unnecessary dependencies
legoktm Dec 19, 2022
cf63e56
Update CI for Python 3.9/bullseye
legoktm Dec 19, 2022
75e8d2a
Merge pull request #177 from freedomofpress/certifi
zenmonkeykstop Dec 19, 2022
85ba1e0
Update dev requirements
eaon Feb 2, 2023
a33a44e
Make all the dev tools happy
eaon Feb 2, 2023
ef052b8
Merge pull request #178 from freedomofpress/update-dev-reqs
zenmonkeykstop Feb 3, 2023
ee792ad
updated requests from 2.26.0 to 2.31.0
zenmonkeykstop May 23, 2023
fc49970
bump python version to 3.9
rocodes May 23, 2023
2981ef2
Merge pull request #180 from freedomofpress/179-update-requests
rocodes May 23, 2023
4482ded
Merge pull request #181 from freedomofpress/bump-supported-python
legoktm Jun 30, 2023
e437c59
Have CI wait for HTTP to be up on server dev environment
legoktm Jul 27, 2023
530895c
Merge pull request #185 from freedomofpress/sleep
eloquence Jul 27, 2023
43c2ae5
Bump certifi dependency due to root certificate removal
eaon Jul 26, 2023
b12a331
Minor CI updates
eloquence Jul 27, 2023
34b9868
Merge pull request #182 from freedomofpress/certifi-bump
legoktm Jul 31, 2023
77d0c51
Clarify comment
eloquence Aug 1, 2023
d74b37b
Merge pull request #186 from freedomofpress/ci-updates
legoktm Aug 1, 2023
c95f7ed
Move sdk files into client/securedrop_client
legoktm Dec 15, 2023
6f518c0
Merge branch 'main' of https://github.com/freedomofpress/securedrop-sdk
legoktm Dec 15, 2023
6612420
Update client to use included sdk
legoktm Dec 15, 2023
7668862
client: Lower coverage requirement to 90%
legoktm Dec 15, 2023
bec09d6
Fix mypy issues related to sdk types
legoktm Dec 15, 2023
3845813
Add sdk test job that runs against an active server
legoktm Dec 15, 2023
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
38 changes: 38 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: SDK
on: [push, pull_request]

defaults:
run:
shell: bash

jobs:
sdk-with-server:
runs-on: ubuntu-latest
env:
DOCKERIZE_VERSION: "v0.7.0"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: "freedomofpress/securedrop"
path: "securedrop-server"
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install poetry==1.6.1
wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz &&
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz &&
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
- name: Run tests without VCR cassettes
run: |
# Start the server in the background
NUM_SOURCES=5 make -C securedrop-server dev &
# And install deps
poetry -C client install --no-ansi
# Wait for server to come up
dockerize -wait http://127.0.0.1:8080 -timeout 5m
# Run tests
rm client/tests/sdk/data/*.yml
make -C client test-sdk
7 changes: 6 additions & 1 deletion client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ clean: ## Clean the workspace of generated resources
TESTS ?= tests
ITESTS ?= tests/integration
FTESTS ?= tests/functional
TESTOPTS ?= -v --cov-config .coveragerc --cov-report html --cov-report term-missing --cov=securedrop_client --cov-fail-under 100
STESTS ?= tests/sdk
TESTOPTS ?= -v --cov-config .coveragerc --cov-report html --cov-report term-missing --cov=securedrop_client --cov-fail-under 90
RANDOM_SEED ?= $(shell bash -c 'echo $$RANDOM')

.PHONY: test
Expand Down Expand Up @@ -104,6 +105,10 @@ test-integration: ## Run the integration tests
test-functional: ## Run the functional tests
@./test-functional.sh

.PHONY: test-sdk
test-sdk: ## Run just the sdk tests
@poetry run pytest -v $(STESTS)

.PHONY: lint
lint: ## Run the linters
@poetry run flake8 securedrop_client tests
Expand Down
1 change: 0 additions & 1 deletion client/build-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ markupsafe==2.0.1 --hash=sha256:e61445980f0dcd584d728844d8ad516c9e460bd71f53c14c
python-dateutil==2.7.5 --hash=sha256:2961735b604e5165d923a4e39b9bcbde6a4c363f257f5477b6339459fd7c1679
python-editor==1.0.3 --hash=sha256:42e5b2a7583cd278dff00ae1fc6b8b735da0502ceeb0914991eaaf5f91ac84ac
requests==2.31.0 --hash=sha256:9f7f0f507fe7a9e10ea51e666da60aafcfcda94c71f0cac477dbadd8d25de49f
securedrop-sdk==0.4.0 --hash=sha256:54b870fd3566914c2ba13aeb5c7eaa0be8ac128be72b45613843c0b75040bd39
six==1.11.0 --hash=sha256:eb52689b06ca7433c1cac3b91f320400bd3b358790b7ff4b6367cb1c81d37561
sqlalchemy==1.3.3 --hash=sha256:af3ec7384a7da692a0db1b807da2eb5bda1372a1eea2a8b26c2ff8ccc1bbf897 --hash=sha256:86ed1e4985a9fd4f3c784da1fcefb89f4435c1c70815f43e5741c0c9f3c79be3
urllib3==1.26.6 --hash=sha256:7a2814749409a681ab58babe6539b02a2f84f6649904211f90fb649811ae7b36
64 changes: 43 additions & 21 deletions client/poetry.lock

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

3 changes: 2 additions & 1 deletion client/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ alembic = "^1.1.0"
arrow = "^0.12.1"
python-dateutil = "^2.7.5"
requests = "^2.31.0"
securedrop-sdk = "^0.4.0"

[tool.poetry.group.dev.dependencies]
# In production these two are installed using a system package
Expand All @@ -38,6 +37,7 @@ isort = "*"
mypy = "^1.4.1"
polib = "*"
pyqt5-stubs = "*"
pyotp = "2.8.0"
pytest = "^7.2.0"
pytest-cov = "*"
pytest-mock = "*"
Expand All @@ -50,6 +50,7 @@ semgrep = "*"
translate-toolkit = "*"
types-polib = "*"
types-python-dateutil = "*"
types-requests = "^2.31.0"
types-setuptools = "^68.0.0"

[tool.black]
Expand Down
5 changes: 3 additions & 2 deletions client/securedrop_client/api_jobs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from typing import Any, Optional, TypeVar

from PyQt5.QtCore import QObject, pyqtSignal
from sdclientapi import API, AuthError, RequestTimeoutError, ServerConnectionError
from sqlalchemy.orm.session import Session

from securedrop_client.sdk import API, AuthError, RequestTimeoutError, ServerConnectionError

logger = logging.getLogger(__name__)

DEFAULT_NUM_ATTEMPTS = 5
Expand Down Expand Up @@ -67,7 +68,7 @@ class ApiJob(QueueJob):
def __init__(self, remaining_attempts: int = DEFAULT_NUM_ATTEMPTS) -> None:
super().__init__(remaining_attempts)

def _do_call_api(self, api_client: API, session: Session) -> None:
def _do_call_api(self, api_client: Optional[API], session: Session) -> None:
if not api_client:
raise ApiInaccessibleError()

Expand Down
6 changes: 3 additions & 3 deletions client/securedrop_client/api_jobs/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from tempfile import NamedTemporaryFile
from typing import Any, Optional, Tuple, Type, Union

from sdclientapi import API, BaseError
from sdclientapi import Reply as SdkReply
from sdclientapi import Submission as SdkSubmission
from sqlalchemy.orm.session import Session

from securedrop_client.api_jobs.base import SingleObjectApiJob
from securedrop_client.crypto import CryptoError, GpgHelper
from securedrop_client.db import DownloadError, DownloadErrorCodes, File, Message, Reply
from securedrop_client.sdk import API, BaseError
from securedrop_client.sdk import Reply as SdkReply
from securedrop_client.sdk import Submission as SdkSubmission
from securedrop_client.storage import (
mark_as_decrypted,
mark_as_downloaded,
Expand Down
2 changes: 1 addition & 1 deletion client/securedrop_client/api_jobs/seen.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import List

from sdclientapi import API
from sqlalchemy.orm.session import Session

from securedrop_client.api_jobs.base import ApiJob
from securedrop_client.sdk import API


class SeenJob(ApiJob):
Expand Down
6 changes: 3 additions & 3 deletions client/securedrop_client/api_jobs/sources.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging

import sdclientapi
from sdclientapi import API, RequestTimeoutError, ServerConnectionError
from sqlalchemy.orm.session import Session

from securedrop_client import sdk
from securedrop_client.api_jobs.base import ApiJob
from securedrop_client.sdk import API, RequestTimeoutError, ServerConnectionError

logger = logging.getLogger(__name__)

Expand All @@ -21,7 +21,7 @@ def call_api(self, api_client: API, session: Session) -> str:
Delete a source on the server
"""
try:
source_sdk_object = sdclientapi.Source(uuid=self.uuid)
source_sdk_object = sdk.Source(uuid=self.uuid)
api_client.delete_source(source_sdk_object)

return self.uuid
Expand Down
4 changes: 2 additions & 2 deletions client/securedrop_client/api_jobs/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import os
from typing import Any, List, Optional

from sdclientapi import API
from sdclientapi import User as SDKUser
from sqlalchemy.orm.session import Session

from securedrop_client import state
from securedrop_client.api_jobs.base import ApiJob
from securedrop_client.db import DeletedUser, DraftReply, User
from securedrop_client.sdk import API
from securedrop_client.sdk import User as SDKUser
from securedrop_client.storage import get_remote_data, update_local_storage

logger = logging.getLogger(__name__)
Expand Down
6 changes: 3 additions & 3 deletions client/securedrop_client/api_jobs/updatestar.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging

import sdclientapi
from sdclientapi import API, RequestTimeoutError, ServerConnectionError
from sqlalchemy.orm.session import Session

from securedrop_client import sdk
from securedrop_client.api_jobs.base import SingleObjectApiJob
from securedrop_client.sdk import API, RequestTimeoutError, ServerConnectionError

logger = logging.getLogger(__name__)

Expand All @@ -21,7 +21,7 @@ def call_api(self, api_client: API, session: Session) -> str:
Star or Unstar an user on the server
"""
try:
source_sdk_object = sdclientapi.Source(uuid=self.uuid)
source_sdk_object = sdk.Source(uuid=self.uuid)

if self.is_starred:
api_client.remove_star(source_sdk_object)
Expand Down
8 changes: 4 additions & 4 deletions client/securedrop_client/api_jobs/uploads.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
import os

import sdclientapi
from sdclientapi import API, RequestTimeoutError, ServerConnectionError
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm.session import Session

from securedrop_client import sdk
from securedrop_client.api_jobs.base import SingleObjectApiJob
from securedrop_client.crypto import GpgHelper
from securedrop_client.db import (
Expand All @@ -16,6 +15,7 @@
Source,
User,
)
from securedrop_client.sdk import API, RequestTimeoutError, ServerConnectionError
from securedrop_client.storage import update_draft_replies

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -151,8 +151,8 @@ def _set_status_to_failed(self, session: Session) -> None:
f"Unknown error when setting reply {self.reply_uuid} as failed, skipping: {e}"
)

def _make_call(self, encrypted_reply: str, api_client: API) -> sdclientapi.Reply:
sdk_source = sdclientapi.Source(uuid=self.source_uuid)
def _make_call(self, encrypted_reply: str, api_client: API) -> sdk.Reply:
sdk_source = sdk.Source(uuid=self.source_uuid)
return api_client.reply_source(sdk_source, encrypted_reply, self.reply_uuid)


Expand Down
Loading