|
5 | 5 | from tests.common import load_fixture |
6 | 6 |
|
7 | 7 |
|
| 8 | +@pytest.fixture(name="test_charger_auth") |
| 9 | +def test_charger_auth(status_mock, config_mock): |
| 10 | + """Load the charger data.""" |
| 11 | + return openevsehttp.OpenEVSE( |
| 12 | + "openevse.test.tld", user="testuser", pwd="fakepassword" |
| 13 | + ) |
| 14 | + |
| 15 | + |
| 16 | +@pytest.fixture(name="test_charger_auth_err") |
| 17 | +def test_charger_auth_err(status_mock_err, config_mock_err): |
| 18 | + """Load the charger data.""" |
| 19 | + with pytest.raises(openevsehttp.AuthenticationError): |
| 20 | + return openevsehttp.OpenEVSE( |
| 21 | + "openevse.test.tld", user="testuser", pwd="fakepassword" |
| 22 | + ) |
| 23 | + |
| 24 | + |
| 25 | +@pytest.fixture(name="status_mock_err") |
| 26 | +def mock_status_err(requests_mock): |
| 27 | + """Mock the status reply.""" |
| 28 | + requests_mock.get( |
| 29 | + "http://openevse.test.tld/status", |
| 30 | + status_code=401, |
| 31 | + ) |
| 32 | + |
| 33 | + |
| 34 | +@pytest.fixture(name="config_mock_err") |
| 35 | +def mock_config_err(requests_mock): |
| 36 | + """Mock the config reply.""" |
| 37 | + requests_mock.get( |
| 38 | + "http://openevse.test.tld/config", |
| 39 | + status_code=401, |
| 40 | + ) |
| 41 | + |
| 42 | + |
8 | 43 | @pytest.fixture(name="test_charger") |
9 | 44 | def test_charger(status_mock, config_mock): |
10 | 45 | """Load the charger data.""" |
|
0 commit comments