'Exercise building of env var headers for kumascript'

def test_env_vars(self):

    headers = dict()
    env_vars = dict(path='/foo/test-slug', title='Test    title', slug='test-slug', locale='de', tags=[u'foo', u'bar', u'baz'])
    kumascript.add_env_headers(headers, env_vars)
    pfx = 'x-kumascript-env-'
    result_vars = dict(((k[len(pfx):], json.loads(base64.b64decode(v))) for (k, v) in headers.items() if k.startswith(pfx)))
    for n in ('title', 'slug', 'locale', 'path'):
        eq_(env_vars[n], result_vars[n])
    eq_(sorted([u'foo', u'bar', u'baz']), sorted(result_vars['tags']))
