~vcs-imports/reviewboard/trunk

« back to all changes in this revision

Viewing changes to reviewboard/hostingsvcs/tests/test_fedora_hosted.py

  • Committer: Christian Hammond
  • Date: 2020-02-06 22:43:02 UTC
  • mfrom: (4677.1.420)
  • Revision ID: git-v1:d76276ebfc2bc2c14a585619094583a2fdde1184
Merge branch 'release-4.0.x'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Unit tests for the Fedora Hosted hosting service."""
2
 
 
3
 
from __future__ import unicode_literals
4
 
 
5
 
from reviewboard.hostingsvcs.testing import HostingServiceTestCase
6
 
 
7
 
 
8
 
class FedoraHosted(HostingServiceTestCase):
9
 
    """Unit tests for the Fedora Hosted hosting service."""
10
 
 
11
 
    service_name = 'fedorahosted'
12
 
 
13
 
    def test_service_support(self):
14
 
        """Testing FedoraHosted service support capabilities"""
15
 
        self.assertTrue(self.service_class.supports_bug_trackers)
16
 
        self.assertTrue(self.service_class.supports_repositories)
17
 
 
18
 
    def test_get_repository_fields_with_git(self):
19
 
        """Testing FedoraHosted.get_repository_fields for Git"""
20
 
        self.assertEqual(
21
 
            self.get_repository_fields(
22
 
                'Git',
23
 
                fields={
24
 
                    'fedorahosted_repo_name': 'myrepo',
25
 
                }
26
 
            ),
27
 
            {
28
 
                'path': 'git://git.fedorahosted.org/git/myrepo.git',
29
 
                'raw_file_url': ('http://git.fedorahosted.org/cgit/myrepo.git/'
30
 
                                 'blob/<filename>?id=<revision>'),
31
 
            })
32
 
 
33
 
    def test_get_repository_fields_with_mercurial(self):
34
 
        """Testing FedoraHosted.get_repository_fields for Mercurial"""
35
 
        self.assertEqual(
36
 
            self.get_repository_fields(
37
 
                'Mercurial',
38
 
                fields={
39
 
                    'fedorahosted_repo_name': 'myrepo',
40
 
                }
41
 
            ),
42
 
            {
43
 
                'path': 'http://hg.fedorahosted.org/hg/myrepo/',
44
 
                'mirror_path': 'https://hg.fedorahosted.org/hg/myrepo/',
45
 
            })
46
 
 
47
 
    def test_get_repository_fields_with_subversion(self):
48
 
        """Testing FedoraHosted.get_repository_fields for Subversion"""
49
 
        self.assertEqual(
50
 
            self.get_repository_fields(
51
 
                'Subversion',
52
 
                fields={
53
 
                    'fedorahosted_repo_name': 'myrepo',
54
 
                }
55
 
            ),
56
 
            {
57
 
                'path': 'http://svn.fedorahosted.org/svn/myrepo/',
58
 
                'mirror_path': 'https://svn.fedorahosted.org/svn/myrepo/',
59
 
            })
60
 
 
61
 
    def test_get_bug_tracker_field(self):
62
 
        """Testing FedoraHosted.get_bug_tracker_field"""
63
 
        self.assertFalse(
64
 
            self.service_class.get_bug_tracker_requires_username())
65
 
        self.assertEqual(
66
 
            self.service_class.get_bug_tracker_field(None, {
67
 
                'fedorahosted_repo_name': 'myrepo',
68
 
            }),
69
 
            'https://fedorahosted.org/myrepo/ticket/%s')