Skip to content

Commit

Permalink
Merge pull request #160 from davfsa/task/freeze-REST-version
Browse files Browse the repository at this point in the history
Remove ability to set REST version
  • Loading branch information
Nekokatt authored Sep 11, 2020
2 parents 23ff394 + 05dac29 commit c8ea005
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
6 changes: 0 additions & 6 deletions hikari/impl/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ class RESTApp(traits.ExecutorAware):
url : typing.Optional[builtins.str]
The base URL for the API. You can generally leave this as being
`builtins.None` and the correct default API base URL will be generated.
version : builtins.int
The Discord API version to use. Can be `6` (stable, default), or `7`
(undocumented development release).
!!! note
This event loop will be bound to a connector when the first call
Expand All @@ -237,7 +234,6 @@ class RESTApp(traits.ExecutorAware):
"_http_settings",
"_proxy_settings",
"_url",
"_version",
)

def __init__(
Expand All @@ -249,7 +245,6 @@ def __init__(
http_settings: typing.Optional[config.HTTPSettings] = None,
proxy_settings: typing.Optional[config.ProxySettings] = None,
url: typing.Optional[str] = None,
version: int = 6,
) -> None:
# Lazy initialized later, since we must initialize this in the event
# loop we run the application from, otherwise aiohttp throws complaints
Expand All @@ -265,7 +260,6 @@ def __init__(
self._http_settings = config.HTTPSettings() if http_settings is None else http_settings
self._proxy_settings = config.ProxySettings() if proxy_settings is None else proxy_settings
self._url = url
self._version = version

@property
def executor(self) -> typing.Optional[concurrent.futures.Executor]:
Expand Down
9 changes: 4 additions & 5 deletions tests/hikari/impl/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def rest_app():
http_settings=mock.Mock(spec_set=config.HTTPSettings),
proxy_settings=mock.Mock(spec_set=config.ProxySettings),
url="https://some.url",
version=3,
)


Expand Down Expand Up @@ -366,14 +365,14 @@ def test__init__when_rest_url_is_not_None_generates_url_using_given_url(self):
)
assert obj._rest_url == "https://some.where/api/v2"

def test___enter__(self, rest_app):
def test___enter__(self, rest_client):
# flake8 gets annoyed if we use "with" here so here's a hacky alternative
with pytest.raises(TypeError, match=" is async-only, did you mean 'async with'?"):
rest_app.__enter__()
rest_client.__enter__()

def test___exit__(self, rest_app):
def test___exit__(self, rest_client):
try:
rest_app.__exit__(None, None, None)
rest_client.__exit__(None, None, None)
except AttributeError as exc:
pytest.fail(exc)

Expand Down

0 comments on commit c8ea005

Please sign in to comment.