def test_get_bin_version_longer(self): stub_mod_check_output(self, cli) stub_base_which(self) # tags are ignored for now. self.check_output_answer = b'version.11.200.345.4928-what' results = cli._get_bin_version('some_app') self.assertEqual(results, (11, 200, 345, 4928))
def test_get_bin_version_no_bin(self): stub_mod_check_output(self, cli, fake_error(OSError)) stub_base_which(self) with pretty_logging(stream=mocks.StringIO()) as err: results = cli._get_bin_version('some_app') self.assertIn("failed to execute 'some_app'", err.getvalue()) self.assertIsNone(results)
def test_get_bin_version_no_bin(self): stub_mod_check_output(self, cli, fake_error(OSError)) stub_base_which(self) with pretty_logging(stream=mocks.StringIO()) as err: results = cli.get_bin_version('some_app') self.assertIn("failed to execute 'some_app'", err.getvalue()) self.assertIsNone(results)
def test_get_bin_version_longer(self): stub_mod_check_output(self, cli) stub_base_which(self) # tags are ignored for now. self.check_output_answer = b'version.11.200.345.4928-what' results = cli.get_bin_version('some_app') self.assertEqual(results, (11, 200, 345, 4928))
def test_get_bin_version_unexpected(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'Nothing' with pretty_logging(stream=mocks.StringIO()) as err: results = cli._get_bin_version('some_app') self.assertIn( "encountered unexpected error while trying to find version of " "'some_app'", err.getvalue()) self.assertIsNone(results)
def test_get_bin_version_unexpected(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'Nothing' with pretty_logging(stream=mocks.StringIO()) as err: results = cli.get_bin_version('some_app') self.assertIn( "encountered unexpected error while trying to find version of " "'some_app'", err.getvalue()) self.assertIsNone(results)
def test_node_version_mocked(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'v0.10.25' version = cli.get_node_version() self.assertEqual(version, (0, 10, 25))
def test_get_bin_version_short(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'1' results = cli._get_bin_version('some_app') self.assertEqual(results, (1, ))
def test_get_bin_version_long(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'Some app v.1.2.3.4. All rights reserved' results = cli._get_bin_version('some_app') self.assertEqual(results, (1, 2, 3, 4))
def test_node_version_mocked(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'v0.10.25' version = cli.get_node_version() self.assertEqual(version, (0, 10, 25))
def test_get_bin_version_short(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'1' results = cli.get_bin_version('some_app') self.assertEqual(results, (1,))
def test_get_bin_version_long(self): stub_mod_check_output(self, cli) stub_base_which(self) self.check_output_answer = b'Some app v.1.2.3.4. All rights reserved' results = cli.get_bin_version('some_app') self.assertEqual(results, (1, 2, 3, 4))