16
16
from scrapyd .webservice import spider_list
17
17
from tests import get_egg_data , get_finished_job , get_message , has_settings , root_add_version , touch
18
18
19
+ cliargs = [sys .executable , "-m" , "scrapyd.runner" , "crawl" , "s2" , "-s" , "DOWNLOAD_DELAY=2" , "-a" , "arg1=val1" ]
20
+
19
21
job1 = get_finished_job (
20
22
project = "p1" ,
21
23
spider = "s1" ,
27
29
28
30
@pytest .fixture ()
29
31
def scrapy_process ():
30
- process = ScrapyProcessProtocol (project = "p1" , spider = "s1" , job = "j1" , env = {}, args = [] )
32
+ process = ScrapyProcessProtocol (project = "p1" , spider = "s1" , job = "j1" , env = {}, args = cliargs )
31
33
process .start_time = datetime .datetime (2001 , 2 , 3 , 4 , 5 , 6 , 9 )
32
34
process .end_time = datetime .datetime (2001 , 2 , 3 , 4 , 5 , 6 , 10 )
33
35
process .transport = MagicMock ()
@@ -374,7 +376,7 @@ def test_list_jobs(txrequest, root, scrapy_process, args, exists, chdir):
374
376
_job = "j1" ,
375
377
_version = "0.1" ,
376
378
settings = {"DOWNLOAD_DELAY=2" : "TRACK=Cause = Time" },
377
- other = "one " ,
379
+ arg1 = "val1 " ,
378
380
)
379
381
380
382
expected ["pending" ].append (
@@ -384,7 +386,7 @@ def test_list_jobs(txrequest, root, scrapy_process, args, exists, chdir):
384
386
"spider" : "s1" ,
385
387
"version" : "0.1" ,
386
388
"settings" : {"DOWNLOAD_DELAY=2" : "TRACK=Cause = Time" },
387
- "args" : {"other " : "one " },
389
+ "args" : {"arg1 " : "val1 " },
388
390
},
389
391
)
390
392
assert_content (txrequest , root , "GET" , "listjobs" , args , expected )
@@ -584,7 +586,7 @@ def test_schedule_parameters(txrequest, root_with_egg):
584
586
b"jobid" : [b"aaa" ],
585
587
b"priority" : [b"5" ],
586
588
b"setting" : [b"DOWNLOAD_DELAY=2" , b"TRACK=Cause = Time" ],
587
- b"other " : [b"one " , b"two " ],
589
+ b"arg1 " : [b"val1 " , b"val2 " ],
588
590
}
589
591
txrequest .method = "POST"
590
592
content = root_with_egg .children [b"schedule.json" ].render (txrequest )
@@ -604,7 +606,7 @@ def test_schedule_parameters(txrequest, root_with_egg):
604
606
"DOWNLOAD_DELAY" : "2" ,
605
607
"TRACK" : "Cause = Time" ,
606
608
},
607
- "other " : "one " , # users are encouraged in api.rst to open an issue if they want multiple values
609
+ "arg1 " : "val1 " , # users are encouraged in api.rst to open an issue if they want multiple values
608
610
}
609
611
610
612
0 commit comments