def test_online_list_keys(self, mock_endpoint_operations: EndpointOperations, randstr: str, mock_aml_services: Mock) -> None: mock_aml_services.online_endpoints.get.return_value = OnlineEndpointPropertiesTrackedResource( name=randstr, properties=OnlineEndpointProperties(auth_mode="key")) mock_endpoint_operations.list_keys(type=ONLINE_ENDPOINT_TYPE, name=randstr) mock_endpoint_operations._online_operation.get.assert_called_once() mock_endpoint_operations._online_operation.list_keys.assert_called_once( )
def _to_rest_online_endpoint_with_traffic( self, location: str) -> OnlineEndpointPropertiesTrackedResource: compute_config, identity = self._to_rest_compute_configuration() properties = OnlineEndpointProperties( description=self.description, auth_mode=self.auth_mode, endpoint=self.name, compute_configuration=compute_config, traffic_rules=self.traffic, ) return OnlineEndpointPropertiesTrackedResource(location=location, properties=properties, identity=identity)
def _to_rest_online_endpoint( self, location: str) -> OnlineEndpointPropertiesTrackedResource: compute_config, identity = self._to_rest_compute_configuration() properties = OnlineEndpointProperties( description=self.description, auth_mode=self.auth_mode, compute_configuration=compute_config, properties=self.properties, ) return OnlineEndpointPropertiesTrackedResource(location=location, properties=properties, identity=identity, tags=self.tags)
def test_online_get(self, mock_endpoint_operations: EndpointOperations, randstr: str, mock_aml_services: Mock) -> None: mock_aml_services.online_endpoints.get.return_value = OnlineEndpointPropertiesTrackedResource( name=randstr, properties=OnlineEndpointProperties( compute_configuration=AksComputeConfiguration( compute_name="compute"), auth_mode="key"), ) mock_aml_services.online_deployments.list.return_value = None mock_endpoint_operations.get(type=ONLINE_ENDPOINT_TYPE, name=randstr) mock_endpoint_operations._online_operation.get.assert_called_once() mock_endpoint_operations._online_deployment.list.assert_called_once()
def test_online_delete_deployment_with_traffic_raise( self, mock_endpoint_operations: EndpointOperations, randstr: str, mock_aml_services: Mock) -> None: deployment_name = "blue" mock_aml_services.online_endpoints.get.return_value = OnlineEndpointPropertiesTrackedResource( name=randstr, properties=OnlineEndpointProperties(auth_mode="key", traffic_rules={ deployment_name: 1, "red": 0 }), ) with pytest.raises(Exception): mock_endpoint_operations.delete(type=ONLINE_ENDPOINT_TYPE, name=randstr, deployment=deployment_name) mock_endpoint_operations._online_operation.get.assert_called_once()