def test_valid_rc(): with tempfile.NamedTemporaryFile('w+t') as f: f.write(VALID_RC) f.flush() valid, msg = validate_rc(f.name) assert valid, msg assert len(msg) == 0, msg
def test_invalid_rc(): rc = ''.join(VALID_RC.splitlines(keepends=True)[:-2]) with tempfile.NamedTemporaryFile('w+t') as f: f.write(rc) f.flush() valid, msg = validate_rc(f.name) assert not valid, msg assert len(msg) > 0, msg assert 'username' in msg