diff options
Diffstat (limited to '')
-rw-r--r-- | test/moodle.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/moodle.py b/test/moodle.py new file mode 100644 index 0000000..3669ef8 --- /dev/null +++ b/test/moodle.py @@ -0,0 +1,25 @@ +import pytest + +import pathlib +import configparser + +from muddle import paths +from muddle import moodle + +config_file = pathlib.Path(paths.default_config_file) +if not config_file.is_file(): + log.error(f"cannot read {config_file}") + sys.exit(1) + +config = configparser.ConfigParser() +config.read(config_file) + + +class TestMoodleInstance: + server = moodle.MoodleInstance(config["server"]["url"], config["server"]["token"]) + + def test_get_userid(self): + assert self.server.get_userid() != None + + def test_get_enrolled_courses(self): + assert type(next(self.server.get_enrolled_courses())) == moodle.Course |