@@ -444,6 +444,20 @@ def test_zipball_url(self):
444
444
expect (self .tag .zipball_url ).isinstance (base .str_test )
445
445
446
446
447
+ def __test_files__ (fd , sha ):
448
+ expect (fd .additions ) > 0
449
+ expect (fd .deletions ) >= 0
450
+ expect (fd .changes ) == fd .additions + fd .deletions
451
+ expect (fd .filename ).isinstance (base .str_test )
452
+ expect (fd .blob_url ).isinstance (base .str_test )
453
+ expect (fd .raw_url ).isinstance (base .str_test )
454
+ expect (fd .sha ).isinstance (base .str_test )
455
+ if sha :
456
+ expect (fd .sha ) == sha
457
+ expect (fd .status ) == 'modified'
458
+ expect (fd .patch ).isinstance (base .str_test )
459
+
460
+
447
461
class TestRepoCommit (base .BaseTest ):
448
462
def __init__ (self , methodName = 'runTest' ):
449
463
super (TestRepoCommit , self ).__init__ (methodName )
@@ -469,16 +483,56 @@ def test_deletions(self):
469
483
def test_files (self ):
470
484
expect (self .commit .files ).isinstance (list )
471
485
expect (self .commit .files ) > []
486
+ self .expect_list_of_class (self .commit .files , type )
472
487
for file in self .commit .files :
473
- expect (file .additions ) > 0
474
- expect (file .deletions ) > 0
475
- expect (file .changes ) == file .additions + file .deletions
476
- expect (file .filename ).isinstance (base .str_test )
477
- expect (file .blob_url ).isinstance (base .str_test )
478
- expect (file .raw_url ).isinstance (base .str_test )
479
- expect (file .sha ) == self .sha
480
- expect (file .status ) == 'modified'
481
- expect (file .patch ).isinstance (base .str_test )
488
+ __test_files__ (file , self .sha )
482
489
483
490
def test_total (self ):
484
491
expect (self .commit .total ) == 17
492
+
493
+
494
+ class TestComparison (base .BaseTest ):
495
+ def __init__ (self , methodName = 'runTest' ):
496
+ super (TestComparison , self ).__init__ (methodName )
497
+ repo = self .g .repository (self .sigm , self .todo )
498
+ self .comp = repo .compare_commits (
499
+ '04d55444a3ec06ca8d2aa0a5e333cdaf27113254' ,
500
+ '731691616b71258c7ad7c141379856b5ebbab310'
501
+ )
502
+
503
+ def test_ahead_by (self ):
504
+ expect (self .comp .ahead_by ) > 0
505
+
506
+ def test_base_commit (self ):
507
+ expect (self .comp .base_commit ).isinstance (RepoCommit )
508
+
509
+ def test_behind_by (self ):
510
+ expect (self .comp .behind_by ) >= 0
511
+
512
+ def test_commits (self ):
513
+ self .expect_list_of_class (self .comp .commits , RepoCommit )
514
+
515
+ def test_diff_url (self ):
516
+ expect (self .comp .diff_url ).isinstance (base .str_test )
517
+
518
+ def test_files (self ):
519
+ expect (self .comp .files ).isinstance (list )
520
+ expect (self .comp .files ) > []
521
+ self .expect_list_of_class (self .comp .files , type )
522
+ for file in self .comp .files :
523
+ __test_files__ (file , '' )
524
+
525
+ def test_html_url (self ):
526
+ expect (self .comp .html_url ).isinstance (base .str_test )
527
+
528
+ def test_patch_url (self ):
529
+ expect (self .comp .patch_url ).isinstance (base .str_test )
530
+
531
+ def test_permalink_url (self ):
532
+ expect (self .comp .permalink_url ).isinstance (base .str_test )
533
+
534
+ def test_status (self ):
535
+ expect (self .comp .status ) == 'ahead'
536
+
537
+ def test_total_commits (self ):
538
+ expect (self .comp .total_commits ) == 18
0 commit comments