Skip to content

Commit d8231b5

Browse files
committed
wip command_interface test
1 parent 10065f7 commit d8231b5

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

src/nrfcredstore/command_interface.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ def get_mfw_version(self):
7575
"""Get modem firmware version, if applicable"""
7676
return
7777

78-
class ATKeygenException(Exception):
79-
def __init__(self, message, exit_code):
80-
super().__init__(message)
81-
self.exit_code = exit_code
82-
8378
class ATCommandInterface(CredentialCommandInterface):
8479
shell = False
8580

tests/test_command_interface.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from unittest.mock import patch, Mock
2+
from collections import namedtuple
3+
import pytest
4+
5+
from nrfcredstore.command_interface import CredentialCommandInterface, ATCommandInterface, TLSCredShellInterface
6+
7+
@pytest.fixture
8+
def comms():
9+
"""Mock comms object"""
10+
comms = Mock()
11+
return comms
12+
13+
@pytest.fixture
14+
def at_command_interface(comms):
15+
"""Mock command interface"""
16+
command_interface = ATCommandInterface(comms)
17+
return command_interface
18+
19+
def test_write_raw(at_command_interface):
20+
"""Test writing raw AT commands"""
21+
at_command_interface.comms.write_line = Mock()
22+
at_command_interface.write_raw('AT+TEST=1')
23+
at_command_interface.comms.write_line.assert_called_once_with('AT+TEST=1')

0 commit comments

Comments
 (0)