surrealpatch/sql/auth_test.go
2017-11-16 20:53:13 +00:00

246 lines
7.3 KiB
Go

// Code generated by https://github.com/abcum/tmpl
// Source file: auth.gen.go.tmpl
// DO NOT EDIT!
// Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package sql
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestAuth(t *testing.T) {
Convey("UseStatement should auth correctly", t, func() {
s := &UseStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("InfoStatement should auth correctly", t, func() {
s := &InfoStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("LetStatement should auth correctly", t, func() {
s := &LetStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("ReturnStatement should auth correctly", t, func() {
s := &ReturnStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("LiveStatement should auth correctly", t, func() {
s := &LiveStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("KillStatement should auth correctly", t, func() {
s := &KillStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("SelectStatement should auth correctly", t, func() {
s := &SelectStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("CreateStatement should auth correctly", t, func() {
s := &CreateStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("UpdateStatement should auth correctly", t, func() {
s := &UpdateStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DeleteStatement should auth correctly", t, func() {
s := &DeleteStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RelateStatement should auth correctly", t, func() {
s := &RelateStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("InsertStatement should auth correctly", t, func() {
s := &InsertStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("UpsertStatement should auth correctly", t, func() {
s := &UpsertStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineNamespaceStatement should auth correctly", t, func() {
s := &DefineNamespaceStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveNamespaceStatement should auth correctly", t, func() {
s := &RemoveNamespaceStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineDatabaseStatement should auth correctly", t, func() {
s := &DefineDatabaseStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveDatabaseStatement should auth correctly", t, func() {
s := &RemoveDatabaseStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineLoginStatement should auth correctly", t, func() {
s := &DefineLoginStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveLoginStatement should auth correctly", t, func() {
s := &RemoveLoginStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineTokenStatement should auth correctly", t, func() {
s := &DefineTokenStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveTokenStatement should auth correctly", t, func() {
s := &RemoveTokenStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineScopeStatement should auth correctly", t, func() {
s := &DefineScopeStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveScopeStatement should auth correctly", t, func() {
s := &RemoveScopeStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineTableStatement should auth correctly", t, func() {
s := &DefineTableStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveTableStatement should auth correctly", t, func() {
s := &RemoveTableStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineEventStatement should auth correctly", t, func() {
s := &DefineEventStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveEventStatement should auth correctly", t, func() {
s := &RemoveEventStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineFieldStatement should auth correctly", t, func() {
s := &DefineFieldStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveFieldStatement should auth correctly", t, func() {
s := &RemoveFieldStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("DefineIndexStatement should auth correctly", t, func() {
s := &DefineIndexStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
Convey("RemoveIndexStatement should auth correctly", t, func() {
s := &RemoveIndexStatement{NS: "namespace", DB: "database"}
n, d := s.Auth()
So(n, ShouldEqual, "namespace")
So(d, ShouldEqual, "database")
})
}