SetTestEnv sets the env variables for testing background ticket in Flex.
()
| 114 | |
| 115 | // SetTestEnv sets the env variables for testing background ticket in Flex. |
| 116 | func SetTestEnv() func() { |
| 117 | var environ = []struct { |
| 118 | key, value string |
| 119 | }{ |
| 120 | {"GAE_LONG_APP_ID", "my-app-id"}, |
| 121 | {"GAE_MINOR_VERSION", "067924799508853122"}, |
| 122 | {"GAE_MODULE_INSTANCE", "0"}, |
| 123 | {"GAE_MODULE_NAME", "default"}, |
| 124 | {"GAE_MODULE_VERSION", "20150612t184001"}, |
| 125 | } |
| 126 | |
| 127 | for _, v := range environ { |
| 128 | old := os.Getenv(v.key) |
| 129 | os.Setenv(v.key, v.value) |
| 130 | v.value = old |
| 131 | } |
| 132 | return func() { // Restore old environment after the test completes. |
| 133 | for _, v := range environ { |
| 134 | if v.value == "" { |
| 135 | os.Unsetenv(v.key) |
| 136 | continue |
| 137 | } |
| 138 | os.Setenv(v.key, v.value) |
| 139 | } |
| 140 | } |
| 141 | } |
no outgoing calls
searching dependent graphs…