Broken tests.
Fixes several bugs.
Tests pass
Finished tests.
Removes unused import.
Fixes view permissions handling.
Merge pull request #2212 from czpython/fixes-2205

Fixes 2205