File: ssid_test.go

package info (click to toggle)
golang-github-twstrike-otr3 0.0~git20161015.0.744856d-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,080 kB
  • sloc: ansic: 127; makefile: 76
file content (26 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package otr3

import "testing"

func Test_SecureSessionID_returnsTheSessionIDAsTwoFormattedStrings(t *testing.T) {
	c := newConversation(nil, fixtureRand())
	c.ssid = [8]byte{0x01, 0x02, 0xF3, 0x04, 0x00, 0x06, 0x07, 0x08}

	parts, _ := c.SecureSessionID()

	assertDeepEquals(t, parts[0], "0102f304")
	assertDeepEquals(t, parts[1], "00060708")
}

func Test_SecureSessionID_returnsTheIndexOfTheValueThatShouldBeHighlighted(t *testing.T) {
	c := newConversation(nil, fixtureRand())
	c.ssid = [8]byte{0x01, 0x02, 0xF3, 0x04, 0x00, 0x06, 0x07, 0x08}

	c.sentRevealSig = true
	_, f := c.SecureSessionID()
	assertEquals(t, f, 0)

	c.sentRevealSig = false
	_, f = c.SecureSessionID()
	assertEquals(t, f, 1)
}