def test_connect(self): f = io.StringIO() open("hello.py", "w").close() with contextlib.redirect_stdout(f): remote, (honesty, included, excluded) = lib50.connect("cs50/lib50/tests/bar", self.loader) self.assertEqual(excluded, set()) self.assertEqual(remote["org"], lib50._api.DEFAULT_PUSH_ORG) f = io.StringIO() loader = lib50.config.Loader("submit50") loader.scope("files", "exclude", "include", "require") with contextlib.redirect_stdout(f): remote, (honesty, included, excluded) = lib50.connect("cs50/lib50/tests/bar", loader) self.assertEqual(included, {"hello.py"})
def test_no_config(self): f = io.StringIO() with contextlib.redirect_stdout(f): with self.assertRaises(lib50.InvalidSlugError): lib50.connect("cs50/lib50/tests/no_config", self.loader)
def test_no_tool_in_config(self): f = io.StringIO() loader = lib50.config.Loader("i_do_not_exist") with contextlib.redirect_stdout(f): with self.assertRaises(lib50.InvalidSlugError): lib50.connect("cs50/lib50/tests/bar", loader)
def test_missing_problem(self): f = io.StringIO() with contextlib.redirect_stdout(f): with self.assertRaises(lib50.InvalidSlugError): lib50.connect("cs50/lib50/tests/i_do_not_exist", self.loader)