Esempio n. 1
0
def test_readable_id_invalid(readable_id_value):
    """
    Test that the Program/Course readable_id field rejects invalid values, and that
    validation is performed when a save is attempted.
    """
    program = ProgramFactory.build(readable_id=readable_id_value)
    with pytest.raises(ValidationError):
        program.save()
    course = CourseFactory.build(program=None, readable_id=readable_id_value)
    with pytest.raises(ValidationError):
        course.save()
Esempio n. 2
0
def test_readable_id_valid(readable_id_value):
    """
    Test that the Program/Course readable_id field accepts valid values, and that
    validation is performed when a save is attempted.
    """
    program = ProgramFactory.build(readable_id=readable_id_value)
    program.save()
    assert program.id is not None
    course = CourseFactory.build(program=None, readable_id=readable_id_value)
    course.save()
    assert course.id is not None
Esempio n. 3
0
 def test_to_string(self):
     """Test for __str__ method"""
     prog = ProgramFactory.build(title="Title")
     assert "{}".format(prog) == "Title"
Esempio n. 4
0
 def test_to_string(self):
     """Test for __str__ method"""
     prog = ProgramFactory.build(title="Title")
     assert "{}".format(prog) == "Title"