Skip to content

Commit 50670ad

Browse files
authored
Fix hardcoded device ID (this can fail when multiple machines run tests concurrently) (#164)
1 parent 3096626 commit 50670ad

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Assets/Plugins/StreamChat/Tests/LowLevelClient/Integration/DeviceApiIntegrationTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#if STREAM_TESTS_ENABLED
2+
using System;
23
using System.Collections;
34
using System.Linq;
45
using System.Threading.Tasks;
@@ -23,24 +24,24 @@ public IEnumerator Test_complete_device_cycle_add_list_remove()
2324

2425
private async Task Test_complete_device_cycle_add_list_remove_Async()
2526
{
26-
const string NewDeviceId = "aaaa-bbb-ccc-111-2222-333";
27+
var newDeviceId = Guid.NewGuid().ToString();
2728

2829
//Add device, expect no errors
2930
await LowLevelClient.DeviceApi.AddDeviceAsync(new CreateDeviceRequest
3031
{
31-
Id = NewDeviceId,
32+
Id = newDeviceId,
3233
PushProvider = PushProviderType.Firebase,
3334
});
3435

3536
//List devices, expect newly added device returned
3637
var listDevices = await LowLevelClient.DeviceApi.ListDevicesAsync(LowLevelClient.UserId);
3738
Assert.NotNull(listDevices.Devices);
38-
var addedDevice = listDevices.Devices.FirstOrDefault(d => d.Id == NewDeviceId);
39+
var addedDevice = listDevices.Devices.FirstOrDefault(d => d.Id == newDeviceId);
3940
Assert.NotNull(addedDevice);
4041
Assert.AreEqual(PushProviderType.Firebase, addedDevice.PushProvider);
4142

4243
//Remove devices, expect no errors
43-
await LowLevelClient.DeviceApi.RemoveDeviceAsync(NewDeviceId, LowLevelClient.UserId);
44+
await LowLevelClient.DeviceApi.RemoveDeviceAsync(newDeviceId, LowLevelClient.UserId);
4445

4546
//Expect device list empty
4647
listDevices = await LowLevelClient.DeviceApi.ListDevicesAsync(LowLevelClient.UserId);

0 commit comments

Comments
 (0)