genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
hs_monolith/runtime/auth_test.go

33 lines
755 B
Go
Raw Normal View History

2017-05-03 08:02:29 +02:00
// Package with supporting functionality to run the microservice
package runtime
import (
"net/http"
"testing"
2017-05-18 00:34:26 +02:00
"github.com/genofire/hs_master-kss-monolith/test"
"github.com/stretchr/testify/assert"
)
2017-05-03 08:02:29 +02:00
// Function to test the permission handling
func TestAuth(t *testing.T) {
assert := assert.New(t)
PermissionURL = "http://localhost:8080/api-test/session/%s/%d/"
router := http.FileServer(http.Dir("../webroot"))
2017-05-18 00:34:26 +02:00
mock := test.MockTransport{Handler: router}
http.DefaultClient.Transport = &mock
mock.Start()
perm, err := HasPermission("testsessionkey", PermissionCreateGood)
assert.NoError(err)
assert.True(perm)
perm, err = HasPermission("testsessionkey", PermissionCreateGood)
assert.NoError(err)
assert.True(perm)
2017-05-18 00:34:26 +02:00
mock.Close()
}