|
@@ -51,7 +51,8 @@ static bool successTemp;
|
|
|
|
|
|
#define TEST_SHELLMATTA_AUTH_SETUP shellmatta_auth_user_t userList[] = { \
|
|
|
{1, false, "shimatta", "12345678"}, \
|
|
|
- {2, false, "not_shimatta", "87654321"} \
|
|
|
+ {2, false, "not_shimatta", "87654321"}, \
|
|
|
+ {3, true, "root", "rootpw"} \
|
|
|
}; \
|
|
|
\
|
|
|
uint32_t privateCmdPerms[] = {1}; \
|
|
@@ -59,7 +60,7 @@ static bool successTemp;
|
|
|
{"private", privateCmdPerms, sizeof(privateCmdPerms)/sizeof(privateCmdPerms[0])} \
|
|
|
}; \
|
|
|
\
|
|
|
- shellmatta_auth_init(handle, userList, 2, permList, 1, false, NULL, NULL);
|
|
|
+ shellmatta_auth_init(handle, userList, 3, permList, 1, false, NULL, NULL);
|
|
|
|
|
|
static shellmatta_retCode_t writeFct(const char* data, uint32_t length)
|
|
|
{
|
|
@@ -276,6 +277,32 @@ SCENARIO("Check help authorized") {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ WHEN("The user root is logged in") {
|
|
|
+ ret = shellmatta_auth_login(handle, 3);
|
|
|
+ CHECK(ret == SHELLMATTA_OK);
|
|
|
+
|
|
|
+ AND_WHEN("The help command is called") {
|
|
|
+
|
|
|
+ ret = shellmatta_processData(handle, (char*)"help\r", 5);
|
|
|
+ CHECK(ret == SHELLMATTA_OK);
|
|
|
+
|
|
|
+ THEN("The help command prints all commands.") {
|
|
|
+
|
|
|
+ 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"
|
|
|
+ "root@shellmatta->";
|
|
|
+
|
|
|
+ CHECK(ret == SHELLMATTA_OK);
|
|
|
+ CHECK(write_length == strlen(dummyData));
|
|
|
+ REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|