@@ -141,6 +141,41 @@ def test_get_comparisionexes_custom_default_branch(self):
141141 self .assertEqual (exe_keys [2 ], '1+L+custom' )
142142 self .assertEqual (exe_keys [3 ], '2+L+custom' )
143143
144+ def test_get_comparisionexes_branch_filtering (self ):
145+ # branch1 and branch3 have display_on_comparison_page flag set to False
146+ # so they shouldn't be included in the result
147+ branch1 = Branch .objects .create (name = 'branch1' , project = self .project ,
148+ display_on_comparison_page = False )
149+ branch2 = Branch .objects .create (name = 'branch2' , project = self .project ,
150+ display_on_comparison_page = True )
151+ branch3 = Branch .objects .create (name = 'branch3' , project = self .project ,
152+ display_on_comparison_page = False )
153+
154+ Revision .objects .create (
155+ branch = branch1 , commitid = '1' )
156+ Revision .objects .create (
157+ branch = branch2 , commitid = '1' )
158+ Revision .objects .create (
159+ branch = branch3 , commitid = '1' )
160+
161+ executables , exe_keys = getcomparisonexes ()
162+ self .assertEqual (len (executables ), 1 )
163+ self .assertEqual (len (executables [self .project ]), 6 )
164+ self .assertEqual (len (exe_keys ), 6 )
165+
166+ expected_exe_keys = [
167+ '1+L+master' ,
168+ '2+L+master' ,
169+ '1+L+custom' ,
170+ '2+L+custom' ,
171+ '1+L+branch2' ,
172+ '2+L+branch2'
173+ ]
174+ self .assertEqual (exe_keys , expected_exe_keys )
175+
176+ for index , exe_key in enumerate (expected_exe_keys ):
177+ self .assertEqual (executables [self .project ][index ]['key' ], exe_key )
178+
144179
145180class UtilityFunctionsTestCase (TestCase ):
146181 @override_settings (TIMELINE_EXECUTABLE_NAME_MAX_LEN = 22 )
0 commit comments