Created
December 21, 2012 06:30
-
-
Save mcdonc/4351050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_it_location_is_not_dir(): | |
from somewhere import Config | |
c = Config() | |
c.os = DummyOS(False) | |
assertRaises(SomeException, setattr, c, settings_location, '/whatever') | |
def test_it_location_is_dir(): | |
from somewhere import Config | |
c = Config() | |
c.os = DummyOS(True) | |
c.settings_location = 'foo' | |
assert c.settings_location == 'foo' | |
class DummyOS(object): | |
def __init__(self, result): | |
self.result = result | |
@property | |
def path(self): | |
return self | |
def isdir(self, location): | |
return self.result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment