示例#1
0
    def test_check_endpoint_json_no_json_given_uuid(self, mocker):
        manager = EndpointManager(funcx_dir=os.getcwd())
        config_dir = os.path.join(manager.funcx_dir, "mock_endpoint")

        manager.configure_endpoint("mock_endpoint", None)
        assert "234567" == manager.check_endpoint_json(
            os.path.join(config_dir, "endpoint.json"), "234567")
示例#2
0
    def test_check_endpoint_json_no_json_no_uuid(self, mocker):
        mock_uuid = mocker.patch(
            "funcx_endpoint.endpoint.endpoint_manager.uuid.uuid4")
        mock_uuid.return_value = 123456

        manager = EndpointManager(funcx_dir=os.getcwd())
        config_dir = os.path.join(manager.funcx_dir, "mock_endpoint")

        manager.configure_endpoint("mock_endpoint", None)
        assert "123456" == manager.check_endpoint_json(
            os.path.join(config_dir, "endpoint.json"), None)
示例#3
0
    def test_check_endpoint_json_given_json(self, mocker):
        manager = EndpointManager(funcx_dir=os.getcwd())
        config_dir = os.path.join(manager.funcx_dir, "mock_endpoint")

        manager.configure_endpoint("mock_endpoint", None)

        mock_dict = {"endpoint_id": "abcde12345"}
        with open(os.path.join(config_dir, "endpoint.json"), "w") as fd:
            json.dump(mock_dict, fd)

        assert "abcde12345" == manager.check_endpoint_json(
            os.path.join(config_dir, "endpoint.json"), "234567")