Exemplo n.º 1
0
 def test_async_main(self, mock_gtm: Mock) -> None:
     args = [
         1,
         Path("/"),
         "mirror",
         1,
         "venv",
         True,
         True,
         False,
         True,
         "stats",
         30,
         True,
         False,
     ]
     mock_gtm.return_value = False
     self.assertEqual(
         self.loop.run_until_complete(ptr.async_main(*args)),
         1  # pyre-ignore
     )
     mock_gtm.return_value = True
     self.assertEqual(
         self.loop.run_until_complete(ptr.async_main(*args)),
         2  # pyre-ignore
     )
     # Make Path() throw a TypeError on purpose so need to ignore type error
     args[4] = 0.69  # pyre-ignore
     self.assertIsNone(
         self.loop.run_until_complete(ptr.async_main(*args))  # pyre-ignore
     )
Exemplo n.º 2
0
 def test_async_main(self, mock_gtm: Mock) -> None:
     args = [1, Path("/"), "mirror", 1, "venv", True, True, "stats"]
     mock_gtm.return_value = False
     self.assertEqual(self.loop.run_until_complete(ptr.async_main(*args)), 1)
     mock_gtm.return_value = True
     self.assertEqual(self.loop.run_until_complete(ptr.async_main(*args)), 2)
     # Make Path() throw a TypeError
     args[4] = 0.69
     self.assertIsNone(self.loop.run_until_complete(ptr.async_main(*args)))