Skip to content

Commit

Permalink
Rename NetworkStateMachine to NetworkState
Browse files Browse the repository at this point in the history
  • Loading branch information
kmazurek committed Sep 27, 2021
1 parent ef159a3 commit c5d425c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from statemachine.exceptions import TransitionNotAllowed

from yapapi.network import Network, NetworkError, NetworkStateMachine
from yapapi.network import Network, NetworkError, NetworkState

if sys.version_info >= (3, 8):
from tests.factories.network import NetworkFactory
Expand Down Expand Up @@ -40,7 +40,7 @@ def test_create(self):
assert network.network_address == ip
assert network.netmask == "255.255.255.0"
assert network.nodes_dict == {"192.168.0.1": owner_id}
assert network.state == NetworkStateMachine.ready
assert network.state == NetworkState.ready
network._net_api.create_network.assert_called_with(
network.network_address, network.netmask, network.gateway
)
Expand Down Expand Up @@ -147,9 +147,9 @@ async def test_remove_when_removed(self):
@pytest.mark.asyncio
async def test_network_context_manager(self):
network = NetworkFactory(ip="192.168.0.0/24")
assert network.state == NetworkStateMachine.ready
assert network.state == NetworkState.ready

async with network:
pass

assert network.state == NetworkStateMachine.removed
assert network.state == NetworkState.removed
4 changes: 2 additions & 2 deletions yapapi/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_websocket_uri(self, port: int) -> str:
return f"{net_api_ws}/net/{self.network.network_id}/tcp/{self.ip}/{port}"


class NetworkStateMachine(StateMachine):
class NetworkState(StateMachine):
"""State machine describing the states and lifecycle of a :class:`Network` instance."""

# states
Expand Down Expand Up @@ -144,7 +144,7 @@ def __init__(
self._gateway = gateway
self._owner_id = owner_id
self._owner_ip: IpAddress = ip_address(owner_ip) if owner_ip else self._next_address()
self._state_machine: NetworkStateMachine = NetworkStateMachine()
self._state_machine: NetworkState = NetworkState()

self._nodes: Dict[str, Node] = dict()
"""the mapping between a Golem node id and a Node in this VPN."""
Expand Down

0 comments on commit c5d425c

Please sign in to comment.