def test_message(self): with tempfile.NamedTemporaryFile() as f: f.write('<span>Beaker is <em>awesome</em>!</span>\n') f.flush() self.assertEquals(_load_motd(f.name), '<span>Beaker is <em>awesome</em>!</span>')
def test_empty(self): with tempfile.NamedTemporaryFile() as f: self.assertEquals(_load_motd(f.name), None)
def test_comment_only(self): with tempfile.NamedTemporaryFile() as f: f.write('<!-- span>commented out</span -->\n') f.flush() self.assertEquals(_load_motd(f.name), None)
def test_nonexistent(self): motd = _load_motd('/tmp/this_file_does_not_exist') self.assertEquals(motd, None)