Skip to content

Commit

Permalink
Add get_node_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkubi committed Oct 8, 2022
1 parent c5f25de commit bc2016e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pydactyl/api/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ def list_nodes(self, include=None):
response = self._api_request(endpoint=endpoint, params=params)
return PaginatedResponse(self, endpoint, response)

def get_node_config(self, node_id):
"""Get the Wings configuration for the specified node.
Args:
node_id(int): Pterodactyl Node ID.
"""
response = self._api_request(
endpoint='application/nodes/{}/configuration'.format(node_id))
return response

def get_node_details(self, node_id):
"""Get detailed info for the specified node.
Expand Down
8 changes: 8 additions & 0 deletions tests/application/nodes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def test_get_node_details(self, mock_api):
self.client.nodes.get_node_details(11)
mock_api.assert_called_with(**expected)

@mock.patch('pydactyl.api.base.PterodactylAPI._api_request')
def test_get_node_config(self, mock_api):
expected = {
'endpoint': 'application/nodes/111/configuration',
}
self.client.nodes.get_node_config(111)
mock_api.assert_called_with(**expected)

@mock.patch('pydactyl.api.base.PterodactylAPI._api_request')
def test_create_node(self, mock_api):
expected_data = {
Expand Down

0 comments on commit bc2016e

Please sign in to comment.