Esempio n. 1
0
 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))
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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))
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
 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))
Esempio n. 8
0
 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, ))
Esempio n. 9
0
 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))
Esempio n. 10
0
 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))
Esempio n. 11
0
 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,))
Esempio n. 12
0
 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))