File: auth_test.go

package info (click to toggle)
golang-github-rabbitmq-amqp091-go 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 712 kB
  • sloc: xml: 500; sh: 129; makefile: 46
file content (31 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
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
27
28
29
30
31
package amqp091

import "testing"

func TestPlainAuth(t *testing.T) {
	auth := &PlainAuth{
		Username: "user",
		Password: "pass",
	}

	if auth.Mechanism() != "PLAIN" {
		t.Errorf("Expected PLAIN, got %s", auth.Mechanism())
	}

	expectedResponse := "\000user\000pass"
	if auth.Response() != expectedResponse {
		t.Errorf("Expected %s, got %s", expectedResponse, auth.Response())
	}
}

func TestExternalAuth(t *testing.T) {
	auth := &ExternalAuth{}

	if auth.Mechanism() != "EXTERNAL" {
		t.Errorf("Expected EXTERNAL, got %s", auth.Mechanism())
	}

	if auth.Response() != "\000*\000*" {
		t.Errorf("Expected \000*\000*, got %s", auth.Response())
	}
}