def test_milieu_environment_get_uri_returning_none(): # Given that I have an empty environment env = Environment() # When I try to get a uri variable that doesn't exist, then I get None env.get_uri('blah').should.be.none # And When I try to get a variable that doesn't exist but I provide a # default value, it will be returned instead of none env.get_uri('blah', 'http://yipit.com').host.should.equal('yipit.com')
def test_milieu_environment_get_uri(): # Given that I have an environment with a variable containing a uri env = Environment() env.set('githubpage', 'https://*****:*****@github.com/yipit/milieu') # When I try to get the value as a Uri uri = env.get_uri('githubpage') # Then I see things working uri.scheme.should.equal('https') uri.host.should.equal('github.com') uri.port.should.equal(None) uri.user.should.equal('clarete') uri.password.should.equal('passwd!!') uri.path.should.equal('/yipit/milieu') uri.relative_path.should.equal('yipit/milieu')