def test_check_response_should_raise_exception_with_4xx(): base = ApiBase() with pytest.raises(exc.InvalidCredential): base._check_response(MockResponse('', status_code=401)) with pytest.raises(exc.NotFound): base._check_response(MockResponse('', status_code=404)) with pytest.raises(exc.Duplicated): base._check_response(MockResponse('', status_code=409)) with pytest.raises(exc.CliException): base._check_response(MockResponse('', status_code=400))
def test_check_response_should_pass_with_3xx(): base = ApiBase() base._check_response(MockResponse('', status_code=300)) base._check_response(MockResponse('', status_code=301))