Skip to content

Commit b31ed47

Browse files
Added an update secret unit test
1 parent 99278c0 commit b31ed47

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

RMQClient.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
1029A0E22087A97E00C72924 /* ConnectionDeadlockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1029A0E12087A97E00C72924 /* ConnectionDeadlockTests.swift */; };
1111
4DF6E46D27F6E98100C43208 /* RMQClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEE7FE911C3BCA6000DF8C4F /* RMQClient.framework */; };
12+
5CE0C5292B873842000087B7 /* ConnectionUpdateSecretTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CE0C5282B873842000087B7 /* ConnectionUpdateSecretTest.swift */; };
1213
70311B0B21ED538600AE1804 /* RMQConnectionDefaults.h in Headers */ = {isa = PBXBuildFile; fileRef = 70311B0A21ED538600AE1804 /* RMQConnectionDefaults.h */; };
1314
70338A2421FBAA7C00C9069D /* TLSConnectionIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70338A2321FBAA7C00C9069D /* TLSConnectionIntegrationTest.swift */; };
1415
705359A921D174A400CF6456 /* TestCertificates in Resources */ = {isa = PBXBuildFile; fileRef = 705359A821D174A400CF6456 /* TestCertificates */; };
@@ -238,6 +239,7 @@
238239
/* Begin PBXFileReference section */
239240
1029A0E12087A97E00C72924 /* ConnectionDeadlockTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionDeadlockTests.swift; sourceTree = "<group>"; };
240241
4DF6E43627F6E90700C43208 /* MemoryTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MemoryTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
242+
5CE0C5282B873842000087B7 /* ConnectionUpdateSecretTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionUpdateSecretTest.swift; sourceTree = "<group>"; };
241243
70311B0A21ED538600AE1804 /* RMQConnectionDefaults.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RMQConnectionDefaults.h; sourceTree = "<group>"; };
242244
70338A2321FBAA7C00C9069D /* TLSConnectionIntegrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TLSConnectionIntegrationTest.swift; sourceTree = "<group>"; };
243245
705359A821D174A400CF6456 /* TestCertificates */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TestCertificates; sourceTree = SOURCE_ROOT; };
@@ -491,6 +493,7 @@
491493
AE26FA2F1C970E9A00CDBBAA /* Channels */ = {
492494
isa = PBXGroup;
493495
children = (
496+
5CE0C5282B873842000087B7 /* ConnectionUpdateSecretTest.swift */,
494497
AE26FA2D1C970DF100CDBBAA /* RMQChannelContract.swift */,
495498
AE8279841C8D86110013ADD1 /* ChannelAllocationTest.swift */,
496499
AE8AD2681CC545ED00229444 /* RMQFramesetValidatorTest.swift */,
@@ -1292,6 +1295,7 @@
12921295
AE9DB00D1D12AA120005F44B /* RMQTransactionalConfirmationsTest.swift in Sources */,
12931296
AE11F1B21D155C8A007AD330 /* RMQMessageTest.swift in Sources */,
12941297
AE9DB0091D11FDED0005F44B /* ConfirmationsSpy.swift in Sources */,
1298+
5CE0C5292B873842000087B7 /* ConnectionUpdateSecretTest.swift in Sources */,
12951299
AEA8A7621CC97C7900371E38 /* RMQGCDSerialQueueTest.swift in Sources */,
12961300
AE59345B1C8735FA00560A73 /* ChannelSpy.swift in Sources */,
12971301
AE8AD25C1CC4E67F00229444 /* RMQUnallocatedChannelTest.swift in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// ConnectionUpdateSecretTest.swift
3+
// RMQClientTests
4+
//
5+
// Created by Andrew Urban on 22.02.2024.
6+
// Copyright © 2024 VMware. All rights reserved.
7+
//
8+
9+
import XCTest
10+
11+
final class ConnectionUpdateSecretTest: XCTestCase {
12+
13+
func testSendsUpdateSecretMethod() {
14+
let (transport, q, conn, _) = ConnectionWithFakesHelper.connectionAfterHandshake()
15+
16+
let secret = "someSecret"
17+
let reason = "ObjC client needs it"
18+
19+
conn.updateSecret(secret)
20+
21+
try? q.step()
22+
23+
transport.assertClientSentMethod(MethodFixtures.connectionUpdateSecret(secret, reason: reason), channelNumber: 0)
24+
}
25+
26+
}

RMQClientTests/MethodFixtures.swift

+5
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ class MethodFixtures {
214214
static func connectionTuneOk() -> RMQConnectionTuneOk {
215215
return RMQConnectionTuneOk(channelMax: RMQShort(65535), frameMax: RMQLong(RMQFrameMax), heartbeat: RMQShort(60))
216216
}
217+
218+
static func connectionUpdateSecret(_ secret: String,
219+
reason: String) -> RMQConnectionUpdateSecret {
220+
return RMQConnectionUpdateSecret(secret: RMQLongstr(secret), reason: RMQShortstr(reason))
221+
}
217222

218223
static func exchangeBind(_ source: String, destination: String, routingKey: String) -> RMQExchangeBind {
219224
return RMQExchangeBind(destination: destination, source: source, routingKey: routingKey)

0 commit comments

Comments
 (0)