Ver Fonte

fixed integration test for auth module (mockup for now)

stefan há 9 meses atrás
pai
commit
fa5a143e39
1 ficheiros alterados com 13 adições e 14 exclusões
  1. 13 14
      test/integrationtest_auth/test_integration_auth.cpp

+ 13 - 14
test/integrationtest_auth/test_integration_auth.cpp

@@ -21,9 +21,6 @@ extern "C" {
 static uint32_t write_callCnt = 0u;
 static char write_data[1024];
 static uint32_t write_length;
-static uint32_t busyCallCnt;
-static uint32_t notBusyCallCnt;
-static bool suspendBusy;
 
 static shellmatta_retCode_t writeFct(const char* data, uint32_t length)
 {
@@ -61,7 +58,6 @@ static shellmatta_retCode_t privateCmdFct(shellmatta_handle_t handle, const char
 }
 shellmatta_cmd_t privateCmd = {(char*)"private", (char*)"r", NULL, NULL, privateCmdFct, NULL, NULL};
 
-
 TEST_CASE( "check unauthenticated help" ) {
 
     shellmatta_retCode_t ret;
@@ -69,7 +65,14 @@ TEST_CASE( "check unauthenticated help" ) {
     shellmatta_handle_t handle;
     char buffer[1024] = {0};
     char historyBuffer[1024] = {0};
-    char *dummyData =   (char*) "";
+    char *dummyData =   (char*) "help\r\n"
+                                "help     ?   help [command] - print help or usage information\r\n"
+                                "login    li  Login command\r\n"
+                                "logout   lo  Logout command\r\n"
+                                "private  r\r\n"
+                                "public   p\r\n"
+                                "\r\n"
+                                "shellmatta->";
 
     shellmatta_doInit(  &inst,
                         &handle,
@@ -81,22 +84,18 @@ TEST_CASE( "check unauthenticated help" ) {
                         NULL,
                         writeFct);
 
-    busyCallCnt = 0u;
-    notBusyCallCnt = 0u;
+    shellmatta_auth_init(handle, NULL, 0, NULL, 0, false, NULL, NULL);
+
     write_callCnt = 0u;
     memset(write_data, 0, sizeof(write_data));
     write_length = 0u;
-    suspendBusy = false;
 
     shellmatta_addCmd(handle, &publicCmd);
     shellmatta_addCmd(handle, &privateCmd);
 
-    do
-    {
-        ret = shellmatta_processData(handle, (char*)"help\r", 5);
-
-    } while (SHELLMATTA_BUSY == ret);
+    ret = shellmatta_processData(handle, (char*)"help\r", 5);
 
-    CHECK( write_length == strlen(dummyData));
+    CHECK(ret == SHELLMATTA_OK);
+    CHECK(write_length == strlen(dummyData));
     REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
 }