#4942 Change the project icon when the project is mirrored from an external source
Merged 3 years ago by pingou. Opened 3 years ago by pingou.

@@ -36,6 +36,9 @@ 

              <h3>

              {% if repo.is_fork -%}

              <i class="fa fa-code-fork text-muted"></i>

+             {% elif repo.mirrored_from -%}

+             <i class="fa fa-cloud-download text-muted" title="Mirrored from {{

+                 repo.mirrored_from }}"></i>

              {%- else -%}

              <i class="fa {{projecticon()}} text-muted"></i>

              {%- endif -%}

@@ -53,6 +53,29 @@ 

          self.session.add(self.project)

          self.session.commit()

  

+     def test_custom_projecticon(self):

+         """ Ensure that the customized project icon is shown the main page of

+         the project.

+         """

+         output = self.app.get("/test")

+         output_text = output.get_data(as_text=True)

+         self.assertIn(

+             '<i class="fa fa-cloud-download text-muted" title="Mirrored from '

+             'https://example.com/foo/bar.git"></i>',

+             output_text,

+         )

+ 

+     def test_regular_projecticon(self):

+         """ Ensure that the customized project icon is shown the main page of

+         the project.

+         """

+         output = self.app.get("/test2")

+         output_text = output.get_data(as_text=True)

+         self.assertNotIn(

+             '<i class="fa fa-cloud-download text-muted" title="Mirrored from ',

+             output_text,

+         )

+ 

      def test_settings_shows(self):

          """ Ensure that the box to edit the mirrored from value shows up

          in the settings.

This will allow to easily find out if a project's primary location
is this pagure instance or elsewhere.

Fixes https://pagure.io/pagure/issue/4941

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

rebased onto 37b3937

3 years ago

Thanks for the review :)

Pull-Request has been merged by pingou

3 years ago