-
Notifications
You must be signed in to change notification settings - Fork 6
Restructures the code base with more object methods #55
Conversation
df2dc21
to
20d029e
Compare
proxy.py Now, Proxy class gets a must conf_path argument, and it creates the inital `conf` attribute from that. Proxy also has default on_save and on_done and err_on_done methods. def handle_response(self) method has a `assert self.res` to mark that res is populated before this call. This is for mypy main.py Mostly has changes from black entrypoint.py No need for fancy dynamic err_call_back, the proxy object will call self.err_call_back if any issue in reading configuration. The test cases now have their own configuration files to create the proxy object. Also, to do proper dynamic attachment of any method of Proxy class we are using https://docs.python.org/3/library/types.html#types.MethodType so that our own on_save or on_done or err_on_done will be called during tests.
in order to review/merge freedomofpress/securedrop-proxy#55
note that we should merge freedomofpress/securedrop-builder#120 first otherwise we'll break stretch nightlies |
this looks great! diff lgtm here but I noticed that the test plan involved installing the deb to |
I copy pasted in sd-proxy and tested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff lgtm, and gave this in a spin in Qubes, all good - thanks for these changes!
@rmol I'll wait before merging so you have a chance to comment on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, except for one preexisting problem your changes made me notice, and a check that's obsoleted by your work. I did not test in Qubes since @redshiftzero already did.
2e02cfc
to
c17bac9
Compare
Moves configuration related code and also callbacks as proper methods into Proxy class.
The test cases now have their own configuration files to create the proxy
object. Also, to do proper dynamic attachment of any method of Proxy class
we are using https://docs.python.org/3/library/types.html#types.MethodType
so that our own on_save or on_done or err_on_done will be called during
tests.
stretch test will fail as it does not have any variable level type annotation.
Testing
securedrop-proxy
source distribution:python setup.py sdist
.deb
:securedrop-debian-packaging
, runPKG_PATH=/home/user/src/securedrop-proxy/dist/securedrop-proxy-0.1.6.tar.gz PKG_VERSION=0.1.6 make securedrop-proxy
(adjust the path to your working copy of this repo as necessary).deb
insd-proxy-buster-template
:qvm-copy ~/debbuild/packaging/securedrop-proxy_0.1.6+buster_all.deb
and specifysd-proxy-buster-template
as the target VMsd-proxy-buster-template
, run:cp ~/QubesIncoming/sd-dev/securedrop-proxy_0.1.6+buster_all.deb /tmp
sudo apt install /tmp/securedrop-proxy_0.1.6+buster_all.deb
sd-svs
and confirm that the proxy is communicating with the server: submissions and replies should populate with no errors.