summaryrefslogtreecommitdiff
path: root/src/mongo/db/namespace_string_test.cpp
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2015-01-12 11:19:53 -0500
committerJason Rassi <rassi@10gen.com>2015-01-12 11:25:49 -0500
commitcc1283f11b689850a66b935b9242a058d6d4ff2e (patch)
treec8258817fd29b5ff596d7e2d53047d6abc25d0d4 /src/mongo/db/namespace_string_test.cpp
parent8d60222b5fd085c7d264cbd8ab4bb0267d7822a5 (diff)
downloadmongo-cc1283f11b689850a66b935b9242a058d6d4ff2e.tar.gz
SERVER-16657 Auth check for ops on cursors owned by global cursor mgr
Diffstat (limited to 'src/mongo/db/namespace_string_test.cpp')
-rw-r--r--src/mongo/db/namespace_string_test.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mongo/db/namespace_string_test.cpp b/src/mongo/db/namespace_string_test.cpp
index 45e4ae00177..0a062e28922 100644
--- a/src/mongo/db/namespace_string_test.cpp
+++ b/src/mongo/db/namespace_string_test.cpp
@@ -86,6 +86,41 @@ namespace mongo {
ASSERT( NamespaceString::normal( "local.oplog.$main" ) );
}
+ TEST(NamespaceStringTest, ListCollectionsGetMore) {
+ ASSERT(NamespaceString("test.$cmd.listCollections").isListCollectionsGetMore());
+
+ ASSERT(!NamespaceString("test.foo").isListCollectionsGetMore());
+ ASSERT(!NamespaceString("test.foo.$cmd.listCollections").isListCollectionsGetMore());
+ ASSERT(!NamespaceString("test.$cmd.").isListCollectionsGetMore());
+ ASSERT(!NamespaceString("test.$cmd.foo.").isListCollectionsGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listCollections.").isListCollectionsGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listIndexes").isListCollectionsGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listIndexes.foo").isListCollectionsGetMore());
+ }
+
+ TEST(NamespaceStringTest, ListIndexesGetMore) {
+ NamespaceString ns1("test.$cmd.listIndexes.f");
+ ASSERT(ns1.isListIndexesGetMore());
+ ASSERT("test.f" == ns1.getTargetNSForListIndexesGetMore().ns());
+
+ NamespaceString ns2("test.$cmd.listIndexes.foo");
+ ASSERT(ns2.isListIndexesGetMore());
+ ASSERT("test.foo" == ns2.getTargetNSForListIndexesGetMore().ns());
+
+ NamespaceString ns3("test.$cmd.listIndexes.foo.bar");
+ ASSERT(ns3.isListIndexesGetMore());
+ ASSERT("test.foo.bar" == ns3.getTargetNSForListIndexesGetMore().ns());
+
+ ASSERT(!NamespaceString("test.foo").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.foo.$cmd.listIndexes").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.$cmd.").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.$cmd.foo.").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listIndexes").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listIndexes.").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listCollections").isListIndexesGetMore());
+ ASSERT(!NamespaceString("test.$cmd.listCollections.foo").isListIndexesGetMore());
+ }
+
TEST( NamespaceStringTest, CollectionComponentValidNames ) {
ASSERT( NamespaceString::validCollectionComponent( "a.b" ) );
ASSERT( NamespaceString::validCollectionComponent( "a.b" ) );