Skip to content

Commit 983425e

Browse files
author
Mirela Chirica
committed
Cellular: Fix cellular network unit test
1 parent 9d78650 commit 983425e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,8 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_activate_context)
227227
ATHandler_stub::resp_stop_success_count = 2;
228228
ATHandler_stub::nsapi_error_value = NSAPI_ERROR_OK;
229229
ATHandler_stub::bool_value = false;
230-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_credentials("apn", CellularNetwork::CHAP, "user", "passwd"));
231-
EXPECT_TRUE(NSAPI_ERROR_AUTH_FAILURE == cn.activate_context());
232-
230+
EXPECT_TRUE(NSAPI_ERROR_OK == my_cn.set_credentials("apn", CellularNetwork::CHAP, "user", "passwd"));
231+
EXPECT_TRUE(NSAPI_ERROR_AUTH_FAILURE == my_cn.activate_context());
233232

234233
// get_context return true and new context created, also do_user_authentication called with success.
235234
// Now there is stack.

features/cellular/framework/API/CellularNetwork.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ class CellularNetwork : public NetworkInterface {
150150
op_status = Unknown;
151151
op_rat = RAT_UNKNOWN;
152152
next = NULL;
153+
op_long[0] = NULL;
154+
op_short[0] = NULL;
155+
op_num[0] = NULL;
153156
}
154157
};
155158

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ nsapi_error_t AT_CellularNetwork::activate_context()
316316

317317
if (!_is_context_active) {
318318
// authenticate before activating or modifying context
319-
if (do_user_authentication() != NSAPI_ERROR_OK) {
319+
nsapi_error_t err = do_user_authentication();
320+
if (err != NSAPI_ERROR_OK) {
320321
tr_error("Cellular authentication failed!");
321-
return _at.unlock_return_error();
322+
return err;
322323
}
323324

324325
tr_info("Activate PDP context %d", _cid);

0 commit comments

Comments
 (0)