Skip to content

Commit bc3d27c

Browse files
committed
fix: fix IntegrationTests by using the newly added TestPushNotificationSender, thus addressing url validation problems with push notification related tests
Signed-off-by: Charles d'Avernas <[email protected]>
1 parent c76bb49 commit bc3d27c

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

tests/a2a-net.IntegrationTests/A2AWebServerStartup.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public override void ConfigureServices(IServiceCollection services)
5656
.SupportsPushNotifications()
5757
.SupportsStateTransitionHistory()
5858
.UseAgentRuntime<MockAgentRuntime>()
59-
.UseDistributedCacheTaskRepository();
59+
.UseDistributedCacheTaskRepository()
60+
.UsePushNotificationSender<TestPushNotificationSender>();
6061
});
6162
}
6263

@@ -71,4 +72,4 @@ public override void Configure(IApplicationBuilder app)
7172
});
7273
}
7374

74-
}
75+
}

tests/a2a-net.IntegrationTests/Cases/A2AProtocolHttpClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public async System.Threading.Tasks.Task SetPushNotifications_Should_Work()
239239
Id = sendRequest.Params.Id,
240240
PushNotificationConfig = new()
241241
{
242-
Url = new("http://fake-url.com")
242+
Url = new(WebServerFactory.Server.BaseAddress, "/callback")
243243
}
244244
}
245245
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright � 2025-Present the a2a-net Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"),
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
namespace A2A.IntegrationTests.Services;
15+
16+
public class TestPushNotificationSender
17+
: IPushNotificationSender
18+
{
19+
20+
public System.Threading.Tasks.Task SendPushNotificationAsync(Uri url, object payload, CancellationToken cancellationToken = default) => System.Threading.Tasks.Task.CompletedTask;
21+
22+
public virtual Task<bool> VerifyPushNotificationUrlAsync(Uri url, CancellationToken cancellationToken = default) => System.Threading.Tasks.Task.FromResult(true);
23+
24+
}

0 commit comments

Comments
 (0)