def test_version_with_snapshot(self, mock_run): snapshot_version = '0.107.SNAPSHOT' mock_run.return_value = snapshot_version expected = server.check_presto_version() self.assertEqual(expected, '') snapshot_version = '0.107-SNAPSHOT' mock_run.return_value = snapshot_version expected = server.check_presto_version() self.assertEqual(expected, '')
def test_td_presto_version(self, mock_run): td_version = '101t' output = _AttributeString(td_version) output.succeeded = True mock_run.return_value = output expected = server.check_presto_version() self.assertEqual(expected, '')
def test_version_with_snapshot(self, mock_run): snapshot_version = '0.107.SNAPSHOT' output = _AttributeString(snapshot_version) output.succeeded = True mock_run.return_value = output expected = server.check_presto_version() self.assertEqual(expected, '') snapshot_version = '0.107.SNAPSHOT-1.x86_64' output = _AttributeString(snapshot_version) output.succeeded = True mock_run.return_value = output expected = server.check_presto_version() self.assertEqual(expected, '') snapshot_version = '0.107-SNAPSHOT' output = _AttributeString(snapshot_version) output.succeeded = True mock_run.return_value = output expected = server.check_presto_version() self.assertEqual(expected, '')
def test_multiple_version_rpms(self, mock_run): err_msg = 'Presto is not installed.' output1 = _AttributeString(err_msg) output1.succeeded = False output2 = _AttributeString('0.111.SNAPSHOT') output2.succeeded = True mock_run.side_effect = [output1, output2] expected = server.check_presto_version() mock_run.assert_any_call('rpm -q --qf \"%{VERSION}\\n\" presto') mock_run.assert_called_with( 'rpm -q --qf \"%{VERSION}\\n\" presto-server-rpm') self.assertEqual(expected, '')
def test_multiple_version_rpms(self, mock_run): output1 = _AttributeString('package presto is not installed') output1.succeeded = False output2 = _AttributeString('presto-server-rpm-0.115t-1.x86_64') output2.succeeded = True output3 = _AttributeString('Presto is not installed.') output3.succeeded = False output4 = _AttributeString('0.111.SNAPSHOT') output4.succeeded = True mock_run.side_effect = [output1, output2, output3, output4] expected = server.check_presto_version() mock_run.assert_has_calls( [call('rpm -q presto'), call('rpm -q presto-server-rpm')]) self.assertEqual(expected, '')
def test_multiple_version_rpms(self, mock_run): output1 = _AttributeString('package presto is not installed') output1.succeeded = False output2 = _AttributeString('presto-server-rpm-0.115t-1.x86_64') output2.succeeded = True output3 = _AttributeString('Presto is not installed.') output3.succeeded = False output4 = _AttributeString('0.111.SNAPSHOT') output4.succeeded = True mock_run.side_effect = [output1, output2, output3, output4] expected = server.check_presto_version() mock_run.assert_has_calls([ call('rpm -q presto'), call('rpm -q presto-server-rpm') ]) self.assertEqual(expected, '')
def test_td_presto_version(self, mock_run): td_version = '101t' mock_run.return_value = td_version expected = server.check_presto_version() self.assertEqual(expected, '')