File tree Expand file tree Collapse file tree 2 files changed +42
-9
lines changed
tests/unit/plugins/module_utils Expand file tree Collapse file tree 2 files changed +42
-9
lines changed Original file line number Diff line number Diff line change 1818 'quiet' : '--quiet' ,
1919 'shrinkwrap' : '--shrinkwrap' ,
2020 },
21- 'deploy' : {},
22- 'invoke' : {},
23- 'list' : {},
21+ 'deploy' : {
22+ 'replace' : '--replace' ,
23+ 'update' : '--update' ,
24+ },
25+ 'list' : {'verbose' : '-v' },
2426 'login' : {},
25- 'logs' : {},
27+ 'logs' : {
28+ 'instance' : '--instance' ,
29+ 'name' : '--name' ,
30+ },
2631 'push' : {},
2732 'remove' : {},
2833 }
3237ARGS_MAP : Final [dict [str , dict [str , str ]]] = dict (
3338 {
3439 'build' : {},
35- 'deploy' : {},
36- 'invoke' : {},
37- 'list' : {},
38- 'login' : {},
40+ 'deploy' : {
41+ 'annotation' : '' ,
42+ 'label' : '' ,
43+ },
44+ 'list' : {'sort' : '--sort' },
45+ 'login' : {
46+ 'username' : '-u' ,
47+ 'password' : '-p' ,
48+ },
3949 'logs' : {},
40- 'push' : {},
50+ 'push' : {'parellel' : '--parallel' },
4151 'remove' : {},
4252 }
4353)
Original file line number Diff line number Diff line change 1+ """unit test for faas module util"""
2+
3+ import pytest
4+ from mschuchard .general .plugins .module_utils import faas
5+
6+
7+ def test_faas_cmd_errors ():
8+ """test various cmd errors"""
9+ # test fails on unsupported action
10+ with pytest .raises (RuntimeError , match = 'Unsupported FaaS action attempted: foo' ):
11+ faas .cmd (action = 'foo' )
12+
13+ # test fails on nonexistent function file
14+ with pytest .raises (FileNotFoundError , match = 'Function config file does not exist or is invalid: /faas.yaml' ):
15+ faas .cmd (action = 'build' , args = {'config_file' : '/faas.yaml' })
16+
17+ # test fails on function file with invalid yaml content
18+ with pytest .warns (SyntaxWarning , match = 'Specified YAML or JSON file does not contain valid YAML or JSON: .gitignore' ), pytest .raises (ValueError ):
19+ faas .cmd (action = 'invoke' , args = {'config_file' : '.gitignore' })
20+
21+
22+ def test_faas_cmd ():
23+ """test various cmd returns"""
You can’t perform that action at this time.
0 commit comments