Skip to content

Commit 9d5c69d

Browse files
committed
Merge branch 'issue999' into issue999_for_develop
2 parents 135b974 + 3fb2b4e commit 9d5c69d

File tree

7 files changed

+63
-4
lines changed

7 files changed

+63
-4
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ jobs:
168168
docker load --input ${{ runner.temp }}/iriswebapp_app.tar
169169
- name: Check out iris
170170
uses: actions/checkout@v4
171+
- uses: actions/setup-node@v4
172+
with:
173+
node-version: 20
174+
cache: npm
175+
cache-dependency-path: ui/package-lock.json
176+
- name: Build ui to be mounted in development docker
177+
working-directory: ui
178+
run: |
179+
npm ci
180+
npm run build
171181
- name: Start development server
172182
run: |
173183
# Even though, we use --env-file option when running docker compose, this is still necessary, because the compose has a env_file attribute :(

source/app/schema/marshables.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ def store_icon(file):
158158

159159
try:
160160
store_fullpath = os.path.join(current_app.config['ASSET_STORE_PATH'], filename)
161-
show_fullpath = os.path.join(current_app.config['APP_PATH'], 'app',
162-
current_app.config['ASSET_SHOW_PATH'].strip(os.path.sep),
163-
filename)
161+
show_fullpath = os.path.join(current_app.config['APP_PATH'],
162+
current_app.config['ASSET_SHOW_PATH'].strip(os.path.sep), filename)
164163
file.save(store_fullpath)
165164
os.symlink(store_fullpath, show_fullpath)
166165

tests/data/img/desktop.png

383 Bytes
Loading

tests/iris.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def delete(self, path):
7272
def post_multipart_encoded_file(self, path, data, file_path):
7373
return self._api.post_multipart_encoded_file(path, data, file_path)
7474

75+
def post_multipart_encoded_files(self, path, data, files):
76+
return self._api.post_multipart_encoded_files(path, data, files)
77+
7578
def create_user(self, user_name, user_password):
7679
body = {
7780
'user_name': user_name,

tests/rest_api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,11 @@ def post_multipart_encoded_file(self, path, data, file_path):
8282
response_as_string = self._convert_response_to_string(response)
8383
print(f'POST {url} {data} {file_path} => {response_as_string}')
8484
return response
85+
86+
def post_multipart_encoded_files(self, path, data, files):
87+
headers = {'Authorization': f'Bearer {self._api_key}'}
88+
url = self._build_url(path)
89+
response = requests.post(url, headers=headers, data=data, files=files)
90+
response_as_string = self._convert_response_to_string(response)
91+
print(f'POST {url} {data} {list(files)} => {response_as_string}')
92+
return response

tests/tests_rest_asset_types.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# IRIS Source Code
2+
# Copyright (C) 2023 - DFIR-IRIS
3+
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation; either
8+
# version 3 of the License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with this program; if not, write to the Free Software Foundation,
17+
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
19+
from unittest import TestCase
20+
from iris import Iris
21+
22+
_FIRST_ASSET_TYPE_IDENTIFIER = 1
23+
24+
25+
class TestsRestAssetTypes(TestCase):
26+
27+
def setUp(self) -> None:
28+
self._subject = Iris()
29+
30+
def tearDown(self):
31+
self._subject.clear_database()
32+
33+
def test_update_asset_type_should_return_200(self):
34+
url = f'/manage/asset-type/update/{_FIRST_ASSET_TYPE_IDENTIFIER}'
35+
data = {'asset_name': 'Account', 'asset_description': 'Generic Account'}
36+
with open('data/img/desktop.png', 'rb') as file_not_compromised:
37+
files = {'asset_icon_not_compromised': file_not_compromised, 'asset_icon_compromised': ('', '')}
38+
response = self._subject.post_multipart_encoded_files(url, data, files)
39+
self.assertEqual(200, response.status_code)

tests/tests_rest_reports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_generate_docx_report__in_safe_mode_should_return_200(self):
3939
data = {'report_name': 'name', 'report_type': 1, 'report_language': 1, 'report_description': 'description',
4040
'report_name_format': 'report_name_format'}
4141
response = self._subject.post_multipart_encoded_file('/manage/templates/add', data,
42-
'data/report_templates/empty.docx').json()
42+
'data/report_templates/empty.docx').json()
4343
report_identifier = response['data']['report_id']
4444
case_identifier = self._subject.create_dummy_case()
4545
response = self._subject.get(f'/case/report/generate-investigation/{report_identifier}',

0 commit comments

Comments
 (0)