File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 11app_name : scotty
2- APP_VERSION : 0.26.0
2+ APP_VERSION : 0.26.1
33SECURITY_PASSWORD_HASH : sha512_crypt
44SQLALCHEMY_TRACK_MODIFICATIONS : false
Original file line number Diff line number Diff line change @@ -96,11 +96,15 @@ def create(user):
9696 if not is_valid_hostname (request .json ['beam' ]['host' ]):
9797 return 'Invalid hostname' , http .client .CONFLICT
9898
99+ directory = request .json ['beam' ]['directory' ]
100+ if directory == '/' :
101+ return 'Invalid beam directory' , http .client .CONFLICT
102+
99103 beam = Beam (
100104 start = current_timeline .datetime .utcnow (), size = 0 ,
101105 host = request .json ['beam' ]['host' ],
102106 comment = request .json ['beam' ].get ('comment' ),
103- directory = request . json [ 'beam' ][ ' directory' ] ,
107+ directory = directory ,
104108 initiator = user .id ,
105109 error = None ,
106110 combadge_contacted = False ,
@@ -164,7 +168,7 @@ def update(beam_id):
164168 else :
165169 json = request .json
166170
167- if 'completed' in request . json :
171+ if 'completed' in json :
168172 beam .completed = json ['completed' ]
169173 beam .error = json .get ('error' , None )
170174
Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ def download_dir(tempdir):
207207@slash .fixture
208208def beam (scotty , local_beam_dir ):
209209 beam = scotty .get_beam (scotty .beam_up (local_beam_dir ))
210+ assert beam .completed
210211 return BeamInfo (beam , None )
211212
212213
Original file line number Diff line number Diff line change 11import subprocess
2-
2+ import http .client
3+ import slash
4+ from requests .exceptions import HTTPError
35
46def test_sanity (scotty ):
57 scotty .sanity_check ()
68
79
10+ def test_forbid_root_beam (scotty ):
11+ with slash .assert_raises (HTTPError ) as e :
12+ scotty .beam_up ("/" )
13+
14+ assert e .exception .response .status_code == http .client .CONFLICT
15+
16+
817def test_independent_beam (beam , local_beam_dir , download_dir ):
918 for file_ in beam .beam .iter_files ():
1019 file_ .download (download_dir )
You can’t perform that action at this time.
0 commit comments