Examples
This package provides a feature to interact by a session-based web session. It also provides a ready-to-use
implementation with balderhub.http.lib.setup_features.client.WebSessionWithRequestsFeature using the
python requests package.
Note
If you want to implement permission / authentification tests, have a look into the contrib section of this documentation.
Creating universal Scenarios
If you need a web session within a test scenario, you can use the
balderhub.http.lib.scenario_features.client.WebSessionFeature like shown below:
from balderhub.http.lib.utils import HttpMethod
class ScenarioExample(balder.Scenario):
class WebSessionDevice(balder.Device):
web = balderhub.http.lib.scenario_features.client.WebSessionFeature()
...
def test_check_website(self):
response = self.WebSessionDevice.web.request(HttpMethod.GET, "https://docs.balder.dev")
assert response.status_code == 200, response
Using it in Setups
You can use a ready-to-use implementation for the balderhub.http.lib.scenario_features.client.WebSessionFeature
with the shipped balderhub.http.lib.setup_features.client.WebSessionWithRequestsFeature:
from balderhub.http.lib.utils import HttpMethod
class SetupWithRequests(balder.Scenario):
class Client(balder.Device):
web = balderhub.http.lib.setup_features.client.WebSessionWithRequestsFeature()
...