2
2
import os
3
3
import json
4
4
import pytest
5
+ import semver
5
6
6
7
this_test_path = os .path .dirname (os .path .realpath (__file__ ))
7
8
# Calculate absolute path of the CLI
@@ -36,6 +37,9 @@ def test_command_lib_list():
36
37
result = run_command ('lib list' , '--format json' )
37
38
assert '{}' == result .stdout
38
39
40
+ # def test_command_lib_download():
41
+ # result = run_command('lib download')
42
+
39
43
40
44
def test_command_lib_install ():
41
45
libs = ['\" AzureIoTProtocol_MQTT\" ' , '\" CMMC MQTT Connector\" ' , '\" WiFiNINA\" ' ]
@@ -45,6 +49,9 @@ def test_command_lib_install():
45
49
result_2 = run_command ('lib install {}' .format (' ' .join (libs )))
46
50
assert result_2 .ok
47
51
52
+ def test_command_lib_update_index ():
53
+ result = run_command ('lib update-index' )
54
+ assert 'Updating index: library_index.json downloaded' == result .stdout .splitlines ()[- 1 ].strip ()
48
55
49
56
def test_command_lib_remove ():
50
57
libs = ['\" AzureIoTProtocol_MQTT\" ' , '\" CMMC MQTT Connector\" ' , '\" WiFiNINA\" ' ]
@@ -83,11 +90,13 @@ def test_command_board_listall():
83
90
result = run_command ('board listall' )
84
91
assert ['Board' , 'Name' , 'FQBN' ] == result .stdout .splitlines ()[0 ].strip ().split ()
85
92
93
+
86
94
def test_command_version ():
87
95
result = run_command ('version --format json' )
88
96
parsed_out = json .loads (result .stdout )
89
97
90
98
assert parsed_out .get ('command' , False ) == 'arduino-cli'
91
- assert parsed_out .get ('version' , False )
92
- assert parsed_out .get ('commit' , False )
99
+ assert isinstance ( semver . parse ( parsed_out .get ('version' , False )), dict )
100
+ assert isinstance ( parsed_out .get ('commit' , False ), str )
93
101
assert parsed_out .get ('build_date' , False )
102
+
0 commit comments