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'), ]
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'), ]
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')])
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 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)
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", ), ]
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", ), ]
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 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)