@@ -20,62 +20,62 @@ def setUp(self):
2020 config ["apiurl" ] = host_options ["apiurl" ]
2121 self .host_options = host_options
2222
23-
24- @patch .dict (os .environ , {}, clear = True )
2523 def test_vc_export_env_conf (self ):
2624 self .host_options .realname = "<REALNAME>"
2725 self .host_options .email = "<EMAIL>"
28- vc_export_env ("http://localhost" )
29- expected = {
30- "VC_REALNAME" : "<REALNAME>" ,
31- "VC_MAILADDR" : "<EMAIL>" ,
32- "mailaddr" : "<EMAIL>" ,
33- }
34- self .assertEqual (os .environ , expected )
3526
36- @patch .dict (os .environ , {}, clear = True )
27+ with patch .dict (os .environ , {}, clear = True ):
28+ vc_export_env ("http://localhost" )
29+ expected = {
30+ "VC_REALNAME" : "<REALNAME>" ,
31+ "VC_MAILADDR" : "<EMAIL>" ,
32+ "mailaddr" : "<EMAIL>" ,
33+ }
34+ self .assertEqual (os .environ , expected )
35+
3736 @GET (
3837 "http://localhost/person/Admin" ,
3938 text = "<person><login>Admin</login><email>root@localhost</email><realname>OBS Instance Superuser</realname></person>" ,
4039 )
4140 def test_vc_export_env_conf_realname (self ):
4241 self .host_options .realname = "<REALNAME>"
43- vc_export_env ("http://localhost" )
44- expected = {
45- "VC_REALNAME" : "<REALNAME>" ,
46- "VC_MAILADDR" : "root@localhost" ,
47- "mailaddr" : "root@localhost" ,
48- }
49- self .assertEqual (os .environ , expected )
42+ with patch .dict (os .environ , {}, clear = True ):
43+ vc_export_env ("http://localhost" )
44+ expected = {
45+ "VC_REALNAME" : "<REALNAME>" ,
46+ "VC_MAILADDR" : "root@localhost" ,
47+ "mailaddr" : "root@localhost" ,
48+ }
49+ self .assertEqual (os .environ , expected )
5050
51- @patch .dict (os .environ , {}, clear = True )
5251 @GET (
5352 "http://localhost/person/Admin" ,
5453 text = "<person><login>Admin</login><email>root@localhost</email><realname>OBS Instance Superuser</realname></person>" ,
5554 )
5655 def test_vc_export_env_conf_email (self ):
5756 self .host_options .email = "<EMAIL>"
58- vc_export_env ("http://localhost" )
59- expected = {
60- "VC_REALNAME" : "OBS Instance Superuser" ,
61- "VC_MAILADDR" : "<EMAIL>" ,
62- "mailaddr" : "<EMAIL>" ,
63- }
64- self .assertEqual (os .environ , expected )
57+ with patch .dict (os .environ , {}, clear = True ):
58+ vc_export_env ("http://localhost" )
59+ expected = {
60+ "VC_REALNAME" : "OBS Instance Superuser" ,
61+ "VC_MAILADDR" : "<EMAIL>" ,
62+ "mailaddr" : "<EMAIL>" ,
63+ }
64+ self .assertEqual (os .environ , expected )
6565
66- @patch .dict (os .environ , {}, clear = True )
6766 @GET (
6867 "http://localhost/person/Admin" ,
6968 text = "<person><login>Admin</login><email>root@localhost</email><realname>OBS Instance Superuser</realname></person>" ,
7069 )
7170 def test_vc_export_env_api_call (self ):
72- vc_export_env ("http://localhost" )
73- expected = {
74- "VC_REALNAME" : "OBS Instance Superuser" ,
75- "VC_MAILADDR" : "root@localhost" ,
76- "mailaddr" : "root@localhost" ,
77- }
78- self .assertEqual (os .environ , expected )
71+ with patch .dict (os .environ , {}, clear = True ):
72+ vc_export_env ("http://localhost" )
73+ expected = {
74+ "VC_REALNAME" : "OBS Instance Superuser" ,
75+ "VC_MAILADDR" : "root@localhost" ,
76+ "mailaddr" : "root@localhost" ,
77+ }
78+ self .assertEqual (os .environ , expected )
7979
8080
8181if __name__ == "__main__" :
0 commit comments