Skip to content

Commit

Permalink
Merge pull request #36 from jadolg/35-add-port-to-new-key-creation-en…
Browse files Browse the repository at this point in the history
…dpoints-new-in-181

Add port to new key creation
  • Loading branch information
jadolg authored Feb 26, 2024
2 parents aed2b4d + 3d9c6e3 commit 16f9078
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion outline_vpn/outline_vpn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
API wrapper for Outline VPN
"""

import typing
from dataclasses import dataclass

Expand Down Expand Up @@ -131,6 +132,7 @@ def create_key(
method: str = None,
password: str = None,
data_limit: int = None,
port: int = None,
) -> OutlineKey:
"""Create a new key"""

Expand All @@ -143,7 +145,8 @@ def create_key(
payload["password"] = password
if data_limit:
payload["limit"] = {"bytes": data_limit}

if port:
payload["port"] = port
if key_id:
payload["id"] = key_id
response = self.session.put(
Expand Down
4 changes: 4 additions & 0 deletions test_outline_vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ def test_create_key_with_attributes(client: OutlineVPN):
data_limit=1024 * 1024 * 20,
method="aes-192-gcm",
password="test",
port=4545,
)
assert key.name == "Another test key"
assert key.method == "aes-192-gcm"
assert key.password == "test"
assert key.data_limit == 1024 * 1024 * 20
assert key.port == 4545
assert client.delete_key(key.key_id)


Expand All @@ -77,12 +79,14 @@ def test_create_key_with_attributes_and_id(client: OutlineVPN):
data_limit=1024 * 1024 * 20,
method="aes-192-gcm",
password="test",
port=2323,
)
assert key.key_id == key_id
assert key.name == "Yet another test key"
assert key.method == "aes-192-gcm"
assert key.password == "test"
assert key.data_limit == 1024 * 1024 * 20
assert key.port == 2323
assert client.delete_key(key.key_id)


Expand Down

0 comments on commit 16f9078

Please sign in to comment.