<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import json <EOL> import tempfile <EOL> import mock <EOL> import conf <EOL> import util <EOL> @ mock . patch ( '<STR_LIT>' , tempfile . NamedTemporaryFile ( ) . name ) <EOL> @ mock . patch ( '<STR_LIT>' , tempfile . NamedTemporaryFile ( ) . name ) <EOL> def test_update_env ( ) : <EOL> try : <EOL> conf . update_env ( '<STR_LIT:test>' ) <EOL> with open ( conf . GCONF_FILE ) as fin : <EOL> gconf = fin . read ( ) <EOL> assert '<STR_LIT>' in gconf <EOL> assert '<STR_LIT>' in gconf <EOL> with open ( conf . DB_FILE ) as fin : <EOL> dbconf = fin . read ( ) <EOL> assert '<STR_LIT>' in dbconf <EOL> assert '<STR_LIT>' in dbconf <EOL> finally : <EOL> util . delete_it ( conf . get ( '<STR_LIT>' ) ) <EOL> util . delete_it ( conf . GCONF_FILE ) <EOL> util . delete_it ( conf . DB_FILE ) <EOL> def test_gconf_generate ( ) : <EOL> try : <EOL> gconf = conf . gconf_generate ( '<STR_LIT:test>' ) <EOL> assert gconf [ '<STR_LIT>' ] == '<STR_LIT:test>' <EOL> assert '<STR_LIT>' in gconf [ '<STR_LIT>' ] <EOL> finally : <EOL> util . delete_it ( gconf [ '<STR_LIT>' ] ) <EOL> @ mock . patch ( '<STR_LIT>' , tempfile . NamedTemporaryFile ( ) . name ) <EOL> def test_get ( ) : <EOL> try : <EOL> with open ( conf . GCONF_FILE , '<STR_LIT:w>' ) as fout : <EOL> json . dump ( { '<STR_LIT:hello>' : '<STR_LIT>' } , fout ) <EOL> assert conf . get ( '<STR_LIT:hello>' ) == '<STR_LIT>' <EOL> finally : <EOL> util . delete_it ( conf . GCONF_FILE ) </s>
