Example #1
0
class ReadTheDocHookCustomTest(object):
    @pytest.fixture(autouse=True)
    def setUp(self, mocker):
        self.releaser = mocker.MagicMock()
        self.releaser.version = Version.parse('1.2.3')
        self.releaser.tag_label = '1.2.3'
        self.releaser.config.__getitem__.return_value = ObjectDict({
            'id': 'fake',
            'url': 'http://{id}.somewhere.io/{tag}',
            'badge': 'http://{id}.somewhere.io/badge/{tag}',
            'bump': '{version}',
            'prepare': 'latest',
        })
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        assert replacements == [
            ('http://fake.somewhere.io/latest', 'http://fake.somewhere.io/1.2.3'),
            ('http://fake.somewhere.io/badge/latest', 'http://fake.somewhere.io/badge/1.2.3'),
        ]

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        assert replacements == [
            ('http://fake.somewhere.io/1.2.3', 'http://fake.somewhere.io/latest'),
            ('http://fake.somewhere.io/badge/1.2.3', 'http://fake.somewhere.io/badge/latest'),
        ]
Example #2
0
class ReadTheDocHookCustomTagTest(object):
    @pytest.fixture(autouse=True)
    def setUp(self, workspace, mocker):
        self.releaser = mocker.MagicMock()
        self.releaser.version = Version.parse('1.2.3')
        self.releaser.tag_label = 'v1.2.3'
        self.releaser.config = Config({ReadTheDocHook.key: {'id': 'fake'}})
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        assert replacements == [
            ('https://fake.readthedocs.io/en/latest', 'https://fake.readthedocs.io/en/v1.2.3'),
            ('https://readthedocs.org/projects/fake/badge/?version=latest',
             'https://readthedocs.org/projects/fake/badge/?version=v1.2.3'),
        ]

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        assert replacements == [
            ('https://fake.readthedocs.io/en/v1.2.3', 'https://fake.readthedocs.io/en/latest'),
            ('https://readthedocs.org/projects/fake/badge/?version=v1.2.3',
             'https://readthedocs.org/projects/fake/badge/?version=latest'),
        ]
Example #3
0
class ReadTheDocHookTest(unittest.TestCase):
    def setUp(self):
        self.releaser = MagicMock()
        self.releaser.version = Version.parse('1.2.3')
        self.releaser.config.__getitem__.return_value = ObjectDict({
            'id':
            'fake',
            'url':
            'http://{id}.somewhere.io/{tag}',
            'bump':
            '{version}',
            'prepare':
            'latest',
        })
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        self.assertEqual(replacements, [('http://fake.somewhere.io/latest',
                                         'http://fake.somewhere.io/1.2.3')])

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        self.assertEqual(replacements, [('http://fake.somewhere.io/1.2.3',
                                         'http://fake.somewhere.io/latest')])
Example #4
0
class ReadTheDocHookCustomTagTest(object):
    @pytest.fixture(autouse=True)
    def setUp(self, workspace, mocker):
        self.releaser = mocker.MagicMock()
        self.releaser.version = Version.parse('1.2.3')
        self.releaser.tag_label = 'v1.2.3'
        self.releaser.config = Config({ReadTheDocHook.key: {'id': 'fake'}})
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        assert replacements == [
            ('https://fake.readthedocs.io/en/latest',
             'https://fake.readthedocs.io/en/v1.2.3'),
            ('https://readthedocs.org/projects/fake/badge/?version=latest',
             'https://readthedocs.org/projects/fake/badge/?version=v1.2.3'),
        ]

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        assert replacements == [
            ('https://fake.readthedocs.io/en/v1.2.3',
             'https://fake.readthedocs.io/en/latest'),
            ('https://readthedocs.org/projects/fake/badge/?version=v1.2.3',
             'https://readthedocs.org/projects/fake/badge/?version=latest'),
        ]
Example #5
0
 def setUp(self):
     self.releaser = MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.config.__getitem__.return_value = ObjectDict({
         'id':
         'fake',
         'url':
         'http://{id}.somewhere.io/{tag}',
         'bump':
         '{version}',
         'prepare':
         'latest',
     })
     self.hook = ReadTheDocHook(self.releaser)
Example #6
0
 def setUp(self, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.tag_label = "1.2.3"
     self.releaser.config.__getitem__.return_value = ObjectDict({
         "id":
         "fake",
         "url":
         "http://{id}.somewhere.io/{tag}",
         "badge":
         "http://{id}.somewhere.io/badge/{tag}",
         "bump":
         "{version}",
         "prepare":
         "latest",
     })
     self.hook = ReadTheDocHook(self.releaser)
Example #7
0
class ReadTheDocHookCustomTest:
    @pytest.fixture(autouse=True)
    def setUp(self, mocker):
        self.releaser = mocker.MagicMock()
        self.releaser.version = Version.parse("1.2.3")
        self.releaser.tag_label = "1.2.3"
        self.releaser.config.__getitem__.return_value = ObjectDict({
            "id":
            "fake",
            "url":
            "http://{id}.somewhere.io/{tag}",
            "badge":
            "http://{id}.somewhere.io/badge/{tag}",
            "bump":
            "{version}",
            "prepare":
            "latest",
        })
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        assert replacements == [
            ("http://fake.somewhere.io/latest",
             "http://fake.somewhere.io/1.2.3"),
            (
                "http://fake.somewhere.io/badge/latest",
                "http://fake.somewhere.io/badge/1.2.3",
            ),
        ]

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        assert replacements == [
            ("http://fake.somewhere.io/1.2.3",
             "http://fake.somewhere.io/latest"),
            (
                "http://fake.somewhere.io/badge/1.2.3",
                "http://fake.somewhere.io/badge/latest",
            ),
        ]
Example #8
0
 def setUp(self):
     self.releaser = MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.config.__getitem__.return_value = ObjectDict({
         'id': 'fake',
         'url': 'http://{id}.somewhere.io/{tag}',
         'bump': '{version}',
         'prepare': 'latest',
     })
     self.hook = ReadTheDocHook(self.releaser)
Example #9
0
class ReadTheDocHookTest(unittest.TestCase):
    def setUp(self):
        self.releaser = MagicMock()
        self.releaser.version = Version.parse('1.2.3')
        self.releaser.config.__getitem__.return_value = ObjectDict({
            'id': 'fake',
            'url': 'http://{id}.somewhere.io/{tag}',
            'bump': '{version}',
            'prepare': 'latest',
        })
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        self.assertEqual(replacements, [('http://fake.somewhere.io/latest', 'http://fake.somewhere.io/1.2.3')])

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        self.assertEqual(replacements, [('http://fake.somewhere.io/1.2.3', 'http://fake.somewhere.io/latest')])
Example #10
0
class ReadTheDocHookCustomTest(object):
    @pytest.fixture(autouse=True)
    def setUp(self, mocker):
        self.releaser = mocker.MagicMock()
        self.releaser.version = Version.parse('1.2.3')
        self.releaser.tag_label = '1.2.3'
        self.releaser.config.__getitem__.return_value = ObjectDict({
            'id':
            'fake',
            'url':
            'http://{id}.somewhere.io/{tag}',
            'badge':
            'http://{id}.somewhere.io/badge/{tag}',
            'bump':
            '{version}',
            'prepare':
            'latest',
        })
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        assert replacements == [
            ('http://fake.somewhere.io/latest',
             'http://fake.somewhere.io/1.2.3'),
            ('http://fake.somewhere.io/badge/latest',
             'http://fake.somewhere.io/badge/1.2.3'),
        ]

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        assert replacements == [
            ('http://fake.somewhere.io/1.2.3',
             'http://fake.somewhere.io/latest'),
            ('http://fake.somewhere.io/badge/1.2.3',
             'http://fake.somewhere.io/badge/latest'),
        ]
Example #11
0
class ReadTheDocHookCustomTagTest:
    @pytest.fixture(autouse=True)
    def setUp(self, workspace, mocker):
        self.releaser = mocker.MagicMock()
        self.releaser.version = Version.parse("1.2.3")
        self.releaser.tag_label = "v1.2.3"
        self.releaser.config = Config({ReadTheDocHook.key: {"id": "fake"}})
        self.hook = ReadTheDocHook(self.releaser)

    def test_bump(self):
        replacements = []
        self.hook.bump(replacements)
        assert replacements == [
            (
                "https://fake.readthedocs.io/en/latest",
                "https://fake.readthedocs.io/en/v1.2.3",
            ),
            (
                "https://readthedocs.org/projects/fake/badge/?version=latest",
                "https://readthedocs.org/projects/fake/badge/?version=v1.2.3",
            ),
        ]

    def test_prepare(self):
        replacements = []
        self.hook.prepare(replacements)
        assert replacements == [
            (
                "https://fake.readthedocs.io/en/v1.2.3",
                "https://fake.readthedocs.io/en/latest",
            ),
            (
                "https://readthedocs.org/projects/fake/badge/?version=v1.2.3",
                "https://readthedocs.org/projects/fake/badge/?version=latest",
            ),
        ]
Example #12
0
 def setUp(self, workspace, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.tag_label = 'v1.2.3'
     self.releaser.config = Config({ReadTheDocHook.key: {'id': 'fake'}})
     self.hook = ReadTheDocHook(self.releaser)
Example #13
0
 def setUp(self, workspace, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse("1.2.3")
     self.releaser.tag_label = "v1.2.3"
     self.releaser.config = Config({ReadTheDocHook.key: {"id": "fake"}})
     self.hook = ReadTheDocHook(self.releaser)
Example #14
0
 def setUp(self, workspace, mocker):
     self.releaser = mocker.MagicMock()
     self.releaser.version = Version.parse('1.2.3')
     self.releaser.tag_label = 'v1.2.3'
     self.releaser.config = Config({ReadTheDocHook.key: {'id': 'fake'}})
     self.hook = ReadTheDocHook(self.releaser)