From 29a50620ffacc9f40eb2e4f0f5f437e3db1858e5 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 16 May 2023 12:30:36 +0200 Subject: [PATCH] Avoid touching internals in Tight auth tests We should test using only external manipulation so we don't assume a specific implementation. --- tests/test.rfb.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test.rfb.js b/tests/test.rfb.js index 6310d8e4..548c82ab 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -1523,14 +1523,16 @@ describe('Remote Frame Buffer Protocol Client', function () { }); it('should accept the "no auth" auth type and transition to SecurityResult', function () { - client._rfbTightVNC = true; + sendNumStrPairs([[0, 'TGHT', 'NOTUNNEL']], client); + client._sock._websocket._getSentData(); // skip the tunnel choice here sendNumStrPairs([[1, 'STDV', 'NOAUTH__']], client); expect(client._sock).to.have.sent(new Uint8Array([0, 0, 0, 1])); expect(client._rfbInitState).to.equal('SecurityResult'); }); it('should accept VNC authentication and transition to that', function () { - client._rfbTightVNC = true; + sendNumStrPairs([[0, 'TGHT', 'NOTUNNEL']], client); + client._sock._websocket._getSentData(); // skip the tunnel choice here sinon.spy(client, "_negotiateStdVNCAuth"); sendNumStrPairs([[2, 'STDV', 'VNCAUTH__']], client); expect(client._sock).to.have.sent(new Uint8Array([0, 0, 0, 2])); @@ -1540,7 +1542,8 @@ describe('Remote Frame Buffer Protocol Client', function () { it('should fail if there are no supported auth types', function () { sinon.spy(client, "_fail"); - client._rfbTightVNC = true; + sendNumStrPairs([[0, 'TGHT', 'NOTUNNEL']], client); + client._sock._websocket._getSentData(); // skip the tunnel choice here sendNumStrPairs([[23, 'stdv', 'badval__']], client); expect(client._fail).to.have.been.calledOnce; });