-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathtest_bits.py
More file actions
27 lines (21 loc) · 878 Bytes
/
Copy pathtest_bits.py
File metadata and controls
27 lines (21 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pytest
import os.path
import windows
import windows.generated_def as gdef
pytestmark = pytest.mark.usefixtures("init_com_security")
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def bitsjob():
newjob = windows.system.bits.create("PFW_TEST_BITSJOB", gdef.BG_JOB_TYPE_DOWNLOAD)
yield newjob
newjob.Cancel()
def test_job_state(bitsjob):
# Check state returns the value and not enum struct
assert bitsjob.state == gdef.BG_JOB_STATE_SUSPENDED
# Enum value should be castable to int
assert int(bitsjob.state) == gdef.BG_JOB_STATE_SUSPENDED
def test_job_multi_files(bitsjob):
bitsjob.AddFile("https://example.com/REMOTE_FILE_1", os.path.join(SCRIPT_PATH, "local1"))
bitsjob.AddFile("https://example.com/REMOTE_FILE_2", os.path.join(SCRIPT_PATH, "local2"))
files = bitsjob.files
assert len(files) == 2