File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 11flake8==3.7.5
2+ pytest==4.2.0
Original file line number Diff line number Diff line change 1+ {
2+ "apiEndpoint" : " http://localhost:8080/api/public/v1/" ,
3+ "apiKey" : " ApiKey XXXX:YYYYY" ,
4+ "products" : " CN-631-322-000"
5+ }
Original file line number Diff line number Diff line change 1+ import os
2+
3+ import pytest
4+
5+ from connectsdk .config import Config
6+
7+
8+ def setup_module (module ):
9+ module .prev_dir = os .getcwd ()
10+ os .chdir (os .path .dirname (os .path .abspath (__file__ )))
11+
12+
13+ def teardown_module (module ):
14+ os .chdir (module .prev_dir )
15+
16+
17+ def test_create_with_non_existing_file ():
18+ with pytest .raises (IOError ):
19+ Config (file = 'non_existing_config.json' )
20+
21+
22+ def test_create_with_file ():
23+ config = Config (file = 'config.json' )
24+ assert config .api_url == 'http://localhost:8080/api/public/v1/'
25+ assert config .api_key == 'ApiKey XXXX:YYYYY'
26+ assert isinstance (config .products , list )
27+ assert len (config .products ) == 1
28+ assert config .products [0 ] == 'CN-631-322-000'
You can’t perform that action at this time.
0 commit comments