示例#1
0
 def test_drop_contest_not_deletable(self):
     Utils.setup_encrypted_file()
     Database.del_meta("admin_token")
     with open(Config.encrypted_file, "wb") as f:
         f.write(Utils.build_pack(ruamel.yaml.dump({"deletable": False})))
     with self.assertRaises(Forbidden):
         self.admin_handler.drop_contest(Utils.ZIP_TOKEN)
示例#2
0
 def test_drop_contest(self):
     Utils.setup_encrypted_file()
     Database.del_meta("admin_token")
     with open(Config.encrypted_file, "wb") as f:
         f.write(Utils.build_pack(ruamel.yaml.dump({"deletable": True})))
     self.admin_handler.drop_contest(Utils.ZIP_TOKEN)
     self.assertFalse(os.path.exists(Config.storedir))
     self.assertFalse(os.path.exists(Config.statementdir))
     self.assertFalse(os.path.exists(Config.contest_path))
     self.assertFalse(os.path.exists(Config.encrypted_file))
     self.assertFalse(os.path.exists(Config.decrypted_file))
     self.assertTrue(os.path.exists(Config.db))