Beispiel #1
0
def test_load_skill_complains_missing_skill_name(load_yaml):
    randomPath = str(random.randint(0, 1000))
    load_yaml.return_value = {"Skill": {}, "New words": [], "Phrases": []}
    expected_error = 'Skill file "{}" needs to have skill name'.format(
        randomPath)
    with pytest.raises(RuntimeError, match=expected_error):
        load_skill(randomPath, fakes.course1)
Beispiel #2
0
def test_load_skill_complains_missing_skills_key(load_yaml):
    randomPath = str(random.randint(0, 1000))
    load_yaml.return_value = {}
    expected_error = 'Skill file "{}" needs to have a "Skill" key'.format(
        randomPath)
    with pytest.raises(RuntimeError, match=expected_error):
        load_skill(randomPath, fakes.course1)
Beispiel #3
0
def test_load_skill_complains_about_an_empty_file(load_yaml):
    randomPath = str(random.randint(0, 1000))
    load_yaml.return_value = None
    with pytest.raises(
            RuntimeError,
            match='Skill file "{}" is empty or does not exist'.format(
                randomPath)):
        load_skill(randomPath, fakes.course1)
Beispiel #4
0
def test_load_skill_doesnt_fail_without_thumnails(load_yaml):
    randomPath = str(random.randint(0, 1000))
    load_yaml.return_value = {
        "Skill": {
            "Name": "asd",
            "Id": "4234234"
        },
        "New words": [],
        "Phrases": []
    }
    load_skill(randomPath, fakes.course1)
Beispiel #5
0
def test_load_skill_complains_about_invalid_word(load_yaml):
    randomPath = str(random.randint(0, 1000))
    load_yaml.return_value = {
        "Skill": {
            "Name": "asd",
            "Id": 32423423
        },
        "Phrases": [],
        "New words": [""]
    }
    expected_error = 'Skill file "{}" has an invalid word'.format(randomPath)
    with pytest.raises(RuntimeError, match=expected_error):
        load_skill(randomPath, fakes.course1)
Beispiel #6
0
 def call_function(self):
     self.fake_path = self.fake_path / "skills"
     self.fake_path.mkdir(parents=True)
     self.create_fake_skill_meta(self.fake_path, **{
         **self.fake_values,
     })
     self.result = load_skill(self.fake_path / "food.yaml")
Beispiel #7
0
 def call_function(self):
     self.fake_path = self.fake_path / "skills"
     self.fake_path.mkdir(parents=True)
     self.create_fake_skill_meta(self.fake_path, **{
         **self.fake_values,
     })
     french = Language(self.fake_values["word3"], "")
     english = Language("English", "")
     self.fake_course = Course(french, english, [], [], None, None)
     self.result = load_skill(self.fake_path / "food.yaml",
                              self.fake_course)