Skip to content

Commit 28aa2b5

Browse files
Fetch exit status from process module instead of sending hard-coded values (#170)
1 parent 137ec5a commit 28aa2b5

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

integration/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ def run_command(command):
2727
output = process.before
2828
response = encode_response(output).splitlines()
2929
except pexpect.TIMEOUT:
30-
return 1, response
31-
return 0, response
30+
process.close()
31+
return process.exitstatus, response
32+
process.close()
33+
return process.exitstatus, response
3234

3335

3436
__all__ = [run_command]

integration/test_auditlogs.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
from datetime import datetime
22
from datetime import timedelta
33

4+
import pytest
45
from integration import run_command
56

6-
BASE_COMMAND = "code42 auditlogs search -b"
7+
BASE_COMMAND = "code42 audit-logs search -b"
8+
begin_date = datetime.utcnow() - timedelta(days=-10)
9+
begin_date_str = begin_date.strftime("%Y-%m-%d %H:%M:%S")
710

811

9-
def test_auditlogs_search():
10-
begin_date = datetime.utcnow() - timedelta(days=-10)
11-
begin_date_str = begin_date.strftime("%Y-%m-%d %H:%M:%S")
12-
return_code, response = run_command(BASE_COMMAND + begin_date_str)
12+
@pytest.mark.parametrize("command", [("{} '{}'".format(BASE_COMMAND, begin_date_str))])
13+
def test_auditlogs_search(command):
14+
return_code, response = run_command(command)
1315
assert return_code == 0

0 commit comments

Comments
 (0)