mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-19 03:48:34 +03:00
Add testsuite for pySim-shell with real cards
This patch adds a comprehensive testsuite for pySim-shell. The testsuite is based on python's unittest framework in combination with pySim-shell scripts. Related: OS#6531 Change-Id: Ieae1330767a6e55e62437f5f988a0d33b727b5de
This commit is contained in:
0
tests/pySim-shell_test/lchan/__init__.py
Normal file
0
tests/pySim-shell_test/lchan/__init__.py
Normal file
20
tests/pySim-shell_test/lchan/test.ok
Normal file
20
tests/pySim-shell_test/lchan/test.ok
Normal file
@@ -0,0 +1,20 @@
|
||||
-> 0070000100
|
||||
<- 9000:
|
||||
-> 0070000200
|
||||
<- 9000:
|
||||
-> 0070000300
|
||||
<- 9000:
|
||||
currently selected file: MF/DF.TELECOM/EF.MSISDN (3f00/7f10/6f40)
|
||||
currently selected file: MF/ADF.USIM/EF.IMSI (3f00/a0000000871002/6f07)
|
||||
currently selected file: MF/ADF.ISIM/EF.AD (3f00/a0000000871004/6fad)
|
||||
[
|
||||
{
|
||||
"response_all_ref_ar_do": null
|
||||
}
|
||||
]
|
||||
-> 0070800100
|
||||
<- 9000:
|
||||
-> 0070800200
|
||||
<- 9000:
|
||||
-> 0070800300
|
||||
<- 9000:
|
||||
34
tests/pySim-shell_test/lchan/test.py
Normal file
34
tests/pySim-shell_test/lchan/test.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Testsuite for pySim-shell.py
|
||||
#
|
||||
# (C) 2024 by sysmocom - s.f.m.c. GmbH
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Author: Philipp Maier
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import unittest
|
||||
import os
|
||||
import json
|
||||
from utils import *
|
||||
|
||||
class test_case(UnittestUtils):
|
||||
def test(self):
|
||||
cardname = 'sysmoISIM-SJA5-S17'
|
||||
|
||||
self.runPySimShell(cardname, "test.script")
|
||||
self.assertEqualFiles("test.tmp")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
40
tests/pySim-shell_test/lchan/test.script
Normal file
40
tests/pySim-shell_test/lchan/test.script
Normal file
@@ -0,0 +1,40 @@
|
||||
set debug true
|
||||
set echo true
|
||||
|
||||
# Open all three additional logical channels
|
||||
set apdu_trace true
|
||||
open_channel 1 > test.tmp
|
||||
open_channel 2 >> test.tmp
|
||||
open_channel 3 >> test.tmp
|
||||
set apdu_trace false
|
||||
|
||||
# Switch through the channels and produce a different state on each channel
|
||||
select DF.TELECOM
|
||||
switch_channel 1
|
||||
select ADF.USIM
|
||||
switch_channel 2
|
||||
select ADF.ISIM
|
||||
switch_channel 3
|
||||
select ADF.ARA-M
|
||||
|
||||
# Switch through the channels and do something to prove that we are still in the expected state
|
||||
switch_channel 0
|
||||
select EF.MSISDN
|
||||
select >> test.tmp
|
||||
switch_channel 1
|
||||
select EF.IMSI
|
||||
select >> test.tmp
|
||||
switch_channel 2
|
||||
select EF.AD
|
||||
select >> test.tmp
|
||||
switch_channel 3
|
||||
aram_delete_all
|
||||
aram_get_all >> test.tmp
|
||||
|
||||
# Close all logical channels again
|
||||
switch_channel 0
|
||||
set apdu_trace true
|
||||
close_channel 1 >> test.tmp
|
||||
close_channel 2 >> test.tmp
|
||||
close_channel 3 >> test.tmp
|
||||
set apdu_trace false
|
||||
Reference in New Issue
Block a user