diff --git a/tests/test_network.py b/tests/test_network.py index c42d89291..3ae636788 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -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 @@ -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 ) @@ -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 diff --git a/yapapi/network.py b/yapapi/network.py index 974a9416e..0543a0036 100644 --- a/yapapi/network.py +++ b/yapapi/network.py @@ -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 @@ -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."""