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 1
1
app_name : scotty
2
- APP_VERSION : 0.26.0
2
+ APP_VERSION : 0.26.1
3
3
SECURITY_PASSWORD_HASH : sha512_crypt
4
4
SQLALCHEMY_TRACK_MODIFICATIONS : false
Original file line number Diff line number Diff line change @@ -96,11 +96,15 @@ def create(user):
96
96
if not is_valid_hostname (request .json ['beam' ]['host' ]):
97
97
return 'Invalid hostname' , http .client .CONFLICT
98
98
99
+ directory = request .json ['beam' ]['directory' ]
100
+ if directory == '/' :
101
+ return 'Invalid beam directory' , http .client .CONFLICT
102
+
99
103
beam = Beam (
100
104
start = current_timeline .datetime .utcnow (), size = 0 ,
101
105
host = request .json ['beam' ]['host' ],
102
106
comment = request .json ['beam' ].get ('comment' ),
103
- directory = request . json [ 'beam' ][ ' directory' ] ,
107
+ directory = directory ,
104
108
initiator = user .id ,
105
109
error = None ,
106
110
combadge_contacted = False ,
@@ -164,7 +168,7 @@ def update(beam_id):
164
168
else :
165
169
json = request .json
166
170
167
- if 'completed' in request . json :
171
+ if 'completed' in json :
168
172
beam .completed = json ['completed' ]
169
173
beam .error = json .get ('error' , None )
170
174
Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ def download_dir(tempdir):
207
207
@slash .fixture
208
208
def beam (scotty , local_beam_dir ):
209
209
beam = scotty .get_beam (scotty .beam_up (local_beam_dir ))
210
+ assert beam .completed
210
211
return BeamInfo (beam , None )
211
212
212
213
Original file line number Diff line number Diff line change 1
1
import subprocess
2
-
2
+ import http .client
3
+ import slash
4
+ from requests .exceptions import HTTPError
3
5
4
6
def test_sanity (scotty ):
5
7
scotty .sanity_check ()
6
8
7
9
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
+
8
17
def test_independent_beam (beam , local_beam_dir , download_dir ):
9
18
for file_ in beam .beam .iter_files ():
10
19
file_ .download (download_dir )
You can’t perform that action at this time.
0 commit comments