def test_current_version_in_latest_env(self) -> None: with temporary_root() as root: os.makedirs(env.base_dir(root)) with open( os.path.join(env.base_dir(root), env.VERSION_FILENAME), "w", encoding="utf-8", ) as f: f.write(__version__) self.assertEqual(__version__, env.current_version(root)) self.assertEqual("nutmeg", env.get_env_release(root)) self.assertIsNone(env.should_upgrade_from_release(root)) self.assertTrue(env.is_up_to_date(root))
def test_save_full(self) -> None: with temporary_root() as root: config = tutor_config.load_full(root) with patch.object(fmt, "STDOUT"): env.save(root, config) self.assertTrue( os.path.exists( os.path.join(env.base_dir(root), "local", "docker-compose.yml")))
def test_save_full_with_https(self) -> None: with temporary_root() as root: config = tutor_config.load_full(root) config["ENABLE_HTTPS"] = True with patch.object(fmt, "STDOUT"): env.save(root, config) with open( os.path.join(env.base_dir(root), "apps", "caddy", "Caddyfile"), encoding="utf-8", ) as f: self.assertIn("www.myopenedx.com{$default_site_port}", f.read())
def test_pathjoin(self) -> None: with temporary_root() as root: self.assertEqual(os.path.join(env.base_dir(root), "dummy"), env.pathjoin(root, "dummy"))