Skip to content

Commit cbeabf6

Browse files
Improve test for 'allowUser' go-mgo#2
1 parent e377422 commit cbeabf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

auth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func (s *S) TestAuthUpsertUserAuthenticationRestrictions(c *C) {
355355
allowUser := &mgo.User{
356356
Username: "allowUser",
357357
Password: "123456",
358-
Roles: []mgo.Role{mgo.RoleRead},
358+
Roles: []mgo.Role{mgo.RoleReadAny},
359359
AuthenticationRestrictions: []mgo.AuthenticationRestriction{
360360
{
361361
ClientSource: []string{"127.0.0.1"},
@@ -369,7 +369,7 @@ func (s *S) TestAuthUpsertUserAuthenticationRestrictions(c *C) {
369369
// Dial again to ensure the positive authentication restriction allows the connection
370370
allowSession, err := mgo.Dial("mongodb://allowUser:[email protected]:40002/admin")
371371
c.Assert(err, IsNil)
372-
c.Assert(allowSession.DB("admin").C("test").Find(nil).All(nil), IsNil)
372+
c.Assert(allowSession.Run(bson.D{{"listDatabases", "1"}}, nil), IsNil)
373373
defer allowSession.Close()
374374

375375
// this user should fail authentication restrictions

0 commit comments

Comments
 (0)