فهرست منبع

added test for autocomplete hiding private commands

stefan 9 ماه پیش
والد
کامیت
d19cd9daa9
1فایلهای تغییر یافته به همراه17 افزوده شده و 1 حذف شده
  1. 17 1
      test/integrationtest_auth/test_integration_auth.cpp

+ 17 - 1
test/integrationtest_auth/test_integration_auth.cpp

@@ -169,7 +169,7 @@ SCENARIO("Check auth unauthorized") {
             }
         }
 
-        WHEN("The a private function is called") {
+        WHEN("A private function is called") {
 
             ret = shellmatta_processData(handle, (char*)"private\r", 8);
             CHECK(ret == SHELLMATTA_OK);
@@ -186,6 +186,22 @@ SCENARIO("Check auth unauthorized") {
                 REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
             }
         }
+
+        WHEN("Autocomplete is triggered") {
+
+            ret = shellmatta_processData(handle, (char*)"\t\t", 2);
+            CHECK(ret == SHELLMATTA_OK);
+
+            THEN("Only public commands are shown.") {
+
+                char *dummyData =   (char*) "\r\n"
+                                            "help    ?    login    li    logout    lo    public    p    \r\n"
+                                            "shellmatta->";
+
+                CHECK(write_length == strlen(dummyData));
+                REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
+            }
+        }
     }
 }