Sometimes is useful for some tests to be able to force an http code that
corresponds to a filure when using the test web server, that way we can
simulate network problems very easily.
This commit adds an option for forcing the web server to return a
specified http code.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
We were using an http server based on the SimpleHTTPRequestHandler to
run most of our server-related tests except for one which was using an
http server based on the BaseHTTPRequestHandler.
This commit merges the functionality of both server clasesses into one
so we use the same one for all future tests.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
As part of the swupd initialization, curl is initialized, which means it
is configured and the connection is tested. When configuring curl for
this test, no timeout was being configured, which was causing curl to
hang waiting for a response from the server if the server was unresponsive.
This commit configures the curl timeouts the same way they are being
configured when downloading files, so in case we get an unresponsive
server (or mirror) it doesn't get stuck forever.
Closes#669
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The server.py script is used in some functional tests to simulate
a slow content server. This commit provides a few extra options
that extend the use of this script for testing purposes.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
PEP8 dictates the style conventions for Python, complying with these
standards is a good practice.
This commit makes a few small changes to comply with PEP8 standards.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Some tests wrote files and directories to /tmp. This change moves the
test certificates directory into the swupd repo's top level directory
and moves other test files into their corresponding test directories.
Fixes#650
Signed-off-by: John Akre <john.w.akre@intel.com>
There were two web server implementations in the functional tests and the
test library's slow server implementation was not functional. These issues
were addressed by the following changes:
- Consolidate test web server implementations into test library
- Add partial download support to start_web_server test library function
- Fix test library slow server functionality.
Signed-off-by: John Akre <john.w.akre@intel.com>
This commit adds the following test objects to testlib:
- start_web_server
- destroy_web_server
This change moves the implementation of web server creation and
destruction from individual tests to the test library.
Signed-off-by: John Akre <john.w.akre@intel.com>