cloudflare/Cloudflare-Pivotal-Cloud-Foundry

Public

mirrored fromhttps://github.com/cloudflare/Cloudflare-Pivotal-Cloud-Foundry

CodeCommitsIssuesPull requestsActionsInsightsSecurity
aa35f88115b8428f8a878e7b2045aa225dc11195

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

api/cloudflare_test.go

33lines · modepreview

package api_test

import (
	"reflect"
	"testing"

	"github.com/cloudflare/Cloudflare-Pivotal-Cloud-Foundry/api"
)

func TestGetAuthHeaders(t *testing.T) {
	email := "my@email.com"
	key := "myKey"
	auth := api.AuthHeaders{XAuthEmail: email, XAuthKey: key}
	testApi := api.CloudflareAPI{Auth: auth}
	testApi.Auth = auth

	result := testApi.GetAuthHeaders()
	if !reflect.DeepEqual(result, auth) {
		t.Errorf("GetAuthHeaders failed")
	}
}

func TestSetAuthHeaders(t *testing.T) {
	email := "my@email.com"
	key := "myKey"
	auth := api.AuthHeaders{XAuthEmail: email, XAuthKey: key}
	testApi := api.CloudflareAPI{}

	testApi.SetAuthHeaders(auth)
	if !reflect.DeepEqual(testApi.Auth, auth) {
		t.Errorf("TestSetAuthHeaders failed")
	}
}