def test_mode_invalid(self): expected_error = "error: API Key Required" assert api.api_handler({"mode": "invalid"}).strip() == expected_error with pytest.raises(IndexError): assert api.api_handler({"mode": []}).strip() == expected_error assert api.api_handler({"mode": ""}).strip() == expected_error assert api.api_handler({"mode": None}).strip() == expected_error
def test_auth_unavailable_password_set(self): assert api.api_handler({"mode": "auth"}).strip() == "None"
def test_auth_apikey_disabled(self): assert api.api_handler({"mode": "auth"}).strip() == "login"
def test_auth(self): assert api.api_handler({"mode": "auth"}).strip() == "apikey"
def test_version(self): assert api.api_handler({ "mode": "version" }).strip() == sabnzbd.__version__
def test_empty(self): with pytest.raises(TypeError): api.api_handler(None) with pytest.raises(AttributeError): api.api_handler("")