mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Fix cellular network unit test
parent
9d78650fcc
commit
983425e4fc
|
@ -227,9 +227,8 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_activate_context)
|
|||
ATHandler_stub::resp_stop_success_count = 2;
|
||||
ATHandler_stub::nsapi_error_value = NSAPI_ERROR_OK;
|
||||
ATHandler_stub::bool_value = false;
|
||||
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_credentials("apn", CellularNetwork::CHAP, "user", "passwd"));
|
||||
EXPECT_TRUE(NSAPI_ERROR_AUTH_FAILURE == cn.activate_context());
|
||||
|
||||
EXPECT_TRUE(NSAPI_ERROR_OK == my_cn.set_credentials("apn", CellularNetwork::CHAP, "user", "passwd"));
|
||||
EXPECT_TRUE(NSAPI_ERROR_AUTH_FAILURE == my_cn.activate_context());
|
||||
|
||||
// get_context return true and new context created, also do_user_authentication called with success.
|
||||
// Now there is stack.
|
||||
|
|
|
@ -150,6 +150,9 @@ public:
|
|||
op_status = Unknown;
|
||||
op_rat = RAT_UNKNOWN;
|
||||
next = NULL;
|
||||
op_long[0] = NULL;
|
||||
op_short[0] = NULL;
|
||||
op_num[0] = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -316,9 +316,10 @@ nsapi_error_t AT_CellularNetwork::activate_context()
|
|||
|
||||
if (!_is_context_active) {
|
||||
// authenticate before activating or modifying context
|
||||
if (do_user_authentication() != NSAPI_ERROR_OK) {
|
||||
nsapi_error_t err = do_user_authentication();
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
tr_error("Cellular authentication failed!");
|
||||
return _at.unlock_return_error();
|
||||
return err;
|
||||
}
|
||||
|
||||
tr_info("Activate PDP context %d", _cid);
|
||||
|
|
Loading…
Reference in New Issue