#3266 Show ban and lock-unlock icon in roadmap page
Merged 5 years ago by pingou. Opened 5 years ago by cqi.

@@ -61,6 +61,12 @@ 

                    {{ issue.comments | count }}

                </span>

                {% endif %}

+               {% if issue.parents %}

+                   <span class="oi" data-glyph="ban" title="Issue blocked by one or more issue(s)"></span>

+               {% endif %}

+               {% if issue.children %}

+                   <span class="oi" data-glyph="lock-unlocked" title="Issue blocking one or more issue(s)"></span>

+               {% endif %}

                {% for tag in issue.tags %}

                  <span class="label label-info"

                  style="background-color:{{ tag.tag_color

@@ -584,6 +584,62 @@ 

          output = self.app.get('/test/roadmap', data=data)

          self.assertEqual(output.status_code, 404)

  

+     @patch('pagure.lib.git.update_git')

+     @patch('pagure.lib.notify.send_email')

+     def test_show_ban_lock_unlock_in_roadmap_ui(self, send_email, update_git):

+         send_email.return_value = True

+         update_git.return_value = True

+ 

+         tests.create_projects(self.session)

+         tests.create_projects_git(

+             os.path.join(self.path, 'repos'), bare=True)

+ 

+         # Create issues to play with

+         repo = pagure.lib.get_authorized_project(self.session, 'test')

+         repo.milestones = {'0.1': ''}

+ 

+         issue_1 = pagure.lib.new_issue(

+             session=self.session,

+             repo=repo,

+             title='Test issue',

+             content='We should work on this',

+             user='pingou',

+             ticketfolder=None,

+             milestone='0.1',

+         )

+ 

+         repo = pagure.lib.get_authorized_project(self.session, 'test')

+         issue_2 = pagure.lib.new_issue(

+             session=self.session,

+             repo=repo,

+             title='Test issue #2',

+             content='We should work on this again',

+             user='foo',

+             ticketfolder=None,

+             milestone='0.1',

+         )

+ 

+         issue_1.children.append(issue_2)

+         self.session.commit()

+ 

+         user = tests.FakeUser()

+         user.username = 'pingou'

+         with tests.user_set(self.app.application, user):

+             output = self.app.get('/test/roadmap')

+             output_text = output.get_data(as_text=True)

+             self.assertIn(

+                 '<span class="oi" data-glyph="ban" '

+                 'title="Issue blocked by one or more issue(s)"></span>',

+                 output_text)

+             self.assertEqual(1, output_text.count(

+                 'title="Issue blocked by one or more issue(s)'))

+             self.assertIn(

+                 '<span class="oi" data-glyph="lock-unlocked" '

+                 'title="Issue blocking one or more issue(s)"></span>',

+                 output_text)

+             self.assertEqual(1, output_text.count(

+                 'title="Issue blocking one or more issue(s)'))

+ 

  

  if __name__ == '__main__':

      unittest.main(verbosity=2)

Signed-off-by: Chenxiong Qi cqi@redhat.com

rebased onto ea5ae12f53da3ad068ce87155da74d99840998ae

5 years ago

I recommend a test for the change, but LGTM otherwise.

I wonder if we should add tests for this?

rebased onto 960178f88c906427ccb9a66779af3fd2a614580f

5 years ago

rebased onto 0f527485ba8b8eec6634fc66e89e0c0d6a4c5407

5 years ago

Pretty please pagure-ci rebuild

Could you count the number of time both titles show up in the page? I expect they appear exactly once in the page :)

rebased onto 78ed110

5 years ago

Pretty please pagure-ci rebuild

Running the tests locally :)

Pretty please pagure-ci rebuild

Tests are passing locally, let's merge ! :)

Pull-Request has been merged by pingou

5 years ago