@@ -361,45 +361,94 @@ def test_request_create(self, capsys, caplog):
361
361
call (['git' , 'init' , '-q' , self .tempdir .name ])
362
362
seen_args , extra_args = self .main_request_create ('guyzmo/test' , 0 ,
363
363
args = {
364
- '<branch>' : 'pr-test' ,
364
+ '<local_branch>' : 'pr-test' ,
365
+ '<remote_branch>' : 'base-test' ,
365
366
'<title>' : 'This is a test' ,
366
367
'--message' : 'This is a test'
367
368
})
368
369
out , err = capsys .readouterr ()
369
- assert ('guyzmo' , 'test' , 'pr-test' , 'This is a test' , 'This is a test' ) == seen_args
370
+ assert ('guyzmo' , 'test' , 'pr-test' , 'base-test' , ' This is a test' , 'This is a test' ) == seen_args
370
371
assert {} == extra_args
371
372
assert out == ''
372
- assert 'Successfully created request of `pr-test` onto `guyzmo/test`, with id `42`!' in caplog .text
373
+ assert 'Successfully created request of `pr-test` onto `guyzmo/test:base-test `, with id `42`!' in caplog .text
373
374
374
375
def test_request_create__no_description (self , capsys , caplog ):
375
376
from subprocess import call
376
377
call (['git' , 'init' , '-q' , self .tempdir .name ])
377
378
seen_args , extra_args = self .main_request_create ('guyzmo/test' , 0 ,
378
379
args = {
379
- '<branch>' : 'pr-test' ,
380
+ '<local_branch>' : 'pr-test' ,
381
+ '<remote_branch>' : 'base-test' ,
380
382
'<title>' : 'This is a test' ,
381
383
})
382
384
out , err = capsys .readouterr ()
383
- assert ('guyzmo' , 'test' , 'pr-test' , 'This is a test' , None ) == seen_args
385
+ assert ('guyzmo' , 'test' , 'pr-test' , 'base-test' , ' This is a test' , None ) == seen_args
384
386
assert {} == extra_args
385
387
assert out == ''
386
- assert 'Successfully created request of `pr-test` onto `guyzmo/test`, with id `42`!' in caplog .text
388
+ assert 'Successfully created request of `pr-test` onto `guyzmo/test:base-test `, with id `42`!' in caplog .text
387
389
388
- def test_request_create__bad_branch (self , capsys , caplog ):
390
+ def test_request_create__bad_local_branch (self , capsys , caplog ):
389
391
from subprocess import call
390
392
call (['git' , 'init' , '-q' , self .tempdir .name ])
391
393
seen_args , extra_args = self .main_request_create ('guyzmo/test' , 2 ,
392
394
args = {
393
- '<branch>' : 'bad' ,
395
+ '<local_branch>' : 'bad' ,
396
+ '<remote_branch>' : 'base-test' ,
394
397
'<title>' : 'This is a test' ,
395
398
'--message' : 'This is a test'
396
399
})
397
400
out , err = capsys .readouterr ()
398
- assert ('guyzmo' , 'test' , 'bad' , 'This is a test' , 'This is a test' ) == seen_args
401
+ assert ('guyzmo' , 'test' , 'bad' , 'base-test' , ' This is a test' , 'This is a test' ) == seen_args
399
402
assert {} == extra_args
400
403
assert out == ''
401
404
assert 'Fatal error: bad branch to request!' in caplog .text
402
405
406
+ def test_request_create__bad_remote_branch (self , capsys , caplog ):
407
+ from subprocess import call
408
+ call (['git' , 'init' , '-q' , self .tempdir .name ])
409
+ seen_args , extra_args = self .main_request_create ('guyzmo/test' , 2 ,
410
+ args = {
411
+ '<local_branch>' : 'pr-test' ,
412
+ '<remote_branch>' : 'bad' ,
413
+ '<title>' : 'This is a test' ,
414
+ '--message' : 'This is a test'
415
+ })
416
+ out , err = capsys .readouterr ()
417
+ assert ('guyzmo' , 'test' , 'pr-test' , 'bad' , 'This is a test' , 'This is a test' ) == seen_args
418
+ assert {} == extra_args
419
+ assert out == ''
420
+ assert 'Fatal error: bad branch to request!' in caplog .text
421
+
422
+ def test_request_create__no_local_branch (self , capsys , caplog ):
423
+ from subprocess import call
424
+ call (['git' , 'init' , '-q' , self .tempdir .name ])
425
+ seen_args , extra_args = self .main_request_create ('guyzmo/test' , 0 ,
426
+ args = {
427
+ '<remote_branch>' : 'base-test' ,
428
+ '<title>' : 'This is a test' ,
429
+ '--message' : 'This is a test'
430
+ })
431
+ out , err = capsys .readouterr ()
432
+ assert ('guyzmo' , 'test' , None , 'base-test' , 'This is a test' , 'This is a test' ) == seen_args
433
+ assert {} == extra_args
434
+ assert out == ''
435
+ assert 'Successfully created request of `pr-test` onto `guyzmo/test:base-test`, with id `42`!' in caplog .text
436
+
437
+ def test_request_create__no_remote_branch (self , capsys , caplog ):
438
+ from subprocess import call
439
+ call (['git' , 'init' , '-q' , self .tempdir .name ])
440
+ seen_args , extra_args = self .main_request_create ('guyzmo/test' , 0 ,
441
+ args = {
442
+ '<local_branch>' : 'pr-test' ,
443
+ '<title>' : 'This is a test' ,
444
+ '--message' : 'This is a test'
445
+ })
446
+ out , err = capsys .readouterr ()
447
+ assert ('guyzmo' , 'test' , 'pr-test' , None , 'This is a test' , 'This is a test' ) == seen_args
448
+ assert {} == extra_args
449
+ assert out == ''
450
+ assert 'Successfully created request of `pr-test` onto `guyzmo/test:base-test`, with id `42`!' in caplog .text
451
+
403
452
def test_open (self ):
404
453
repo_slug , seen_args = self .main_open ('guyzmo/git-repo' , 0 )
405
454
assert ('guyzmo' , 'git-repo' ) == repo_slug
@@ -464,15 +513,16 @@ def test_request_create__no_repo_slug(self, capsys, caplog):
464
513
self ._create_repository ()
465
514
seen_args , extra_args = self .main_request_create (rc = 0 ,
466
515
args = {
467
- '<branch>' : 'pr-test' ,
516
+ '<local_branch>' : 'pr-test' ,
517
+ '<remote_branch>' : 'base-test' ,
468
518
'<title>' : 'This is a test' ,
469
519
'--message' : 'This is a test'
470
520
})
471
521
out , err = capsys .readouterr ()
472
- assert ('guyzmo' , 'git-repo' , 'pr-test' , 'This is a test' , 'This is a test' ) == seen_args
522
+ assert ('guyzmo' , 'git-repo' , 'pr-test' , 'base-test' , ' This is a test' , 'This is a test' ) == seen_args
473
523
assert {} == extra_args
474
524
assert out == ''
475
- assert 'Successfully created request of `pr-test` onto `guyzmo/git-repo`, with id `42`!' in caplog .text
525
+ assert 'Successfully created request of `pr-test` onto `guyzmo/git-repo:base-test `, with id `42`!' in caplog .text
476
526
477
527
def test_config (self , capsys , caplog ):
478
528
import sys , io , getpass
0 commit comments