Skip to content

Commit

Permalink
Fix code generator
Browse files Browse the repository at this point in the history
Code generator was failing due to a change in how the swagger put
params are defined.
grpc-ecosystem/grpc-gateway#201
Fix a few failing tests.
  • Loading branch information
sesposito committed Nov 10, 2022
1 parent a1be41d commit 7b19583
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 237 deletions.
6 changes: 5 additions & 1 deletion Nakama.Tests/HttpErrorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* limitations under the License.
*/

using System.Collections.Generic;
using Nakama.TinyJson;

namespace Nakama.Tests.Api
{
using System;
Expand Down Expand Up @@ -46,7 +49,8 @@ public async Task BadLuaRpcReturnsErrorMessageAndDict()
await Assert.ThrowsAsync<ApiResponseException>(() => _client.RpcAsync(session, funcid));
Assert.NotNull(exception.Message);
Assert.NotEmpty(exception.Message);
Assert.Equal("Some error occured.", exception.Message);
var decoded = exception.Message.FromJson<Dictionary<string, object>>();
Assert.Equal("Some error occured.", decoded["message"]);
}

[Fact(Skip = "requires go plugin")]
Expand Down
4 changes: 2 additions & 2 deletions Nakama.Tests/LinkUnlinkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public async Task ShouldNotUnlinkSteam()
var session = await _client.AuthenticateCustomAsync(customid);

var ex = await Assert.ThrowsAsync<ApiResponseException>(() => _client.UnlinkSteamAsync(session, "invalid"));
Assert.Equal((int) HttpStatusCode.BadRequest, ex.StatusCode);
Assert.Equal((int) HttpStatusCode.Unauthorized, ex.StatusCode);
}

[Fact(Timeout = TestsUtil.TIMEOUT_MILLISECONDS)]
Expand All @@ -411,7 +411,7 @@ public async Task ShouldNotUnlinkApple()
var session = await _client.AuthenticateCustomAsync(customid);

var ex = await Assert.ThrowsAsync<ApiResponseException>(() => _client.UnlinkAppleAsync(session, "invalid"));
Assert.Equal((int) HttpStatusCode.BadRequest, ex.StatusCode);
Assert.Equal((int) HttpStatusCode.Unauthorized, ex.StatusCode);
}
}
}
1 change: 0 additions & 1 deletion Nakama.Tests/RpcTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class RpcTest
public RpcTest()
{
_client = TestsUtil.FromSettingsFile();

}

[Fact(Timeout = TestsUtil.TIMEOUT_MILLISECONDS)]
Expand Down
2 changes: 2 additions & 0 deletions Nakama.Tests/Socket/WebSocketTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

using System;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -65,6 +66,7 @@ public async Task ShouldCreateSocketAndDisconnect()
_socket.Closed += () => completer.SetResult(true);

await _socket.ConnectAsync(session);
await Task.Delay(1000);
await _socket.CloseAsync();

Assert.True(await completer.Task);
Expand Down
Loading

0 comments on commit 7b19583

Please sign in to comment.