diff --git a/cbutil/upload.py b/cbutil/upload.py
index 576e347f2646d958fabd074db8ab6c208ae25e65..23bb2cad93ee60510868315f1404fac27c5264dd 100644
--- a/cbutil/upload.py
+++ b/cbutil/upload.py
@@ -39,7 +39,10 @@ class DBConfig:
 
 class Uploader:
     def __init__(self, config: DBConfig = None):
-        self.config = config if config else load_config_from_env()
+        if config is None:
+            config = load_config_from_env()
+
+        self.config = config
 
         self.client = InfluxDBClient(
             host=config.host,
diff --git a/tests/test_upload.py b/tests/test_upload.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c9c0b53def2f6efe69fa401cd827ec1d5720b1a
--- /dev/null
+++ b/tests/test_upload.py
@@ -0,0 +1,34 @@
+from cbutil.upload import Uploader, DBConfig, load_config_from_env
+import os
+
+
+def setup_env():
+
+    os.environ["INFLUXDB_HOST"] = "INFLUXDB_HOST"
+    os.environ["INFLUXDB_PORT"] = "1234"
+    os.environ["INFLUXDB_USER_NAME"] = "INFLUXDB_USER_NAME"
+    os.environ["INFLUXDB_DATABASE"] = "INFLUXDB_DATABASE"
+    os.environ["INFLUXDB_WRITE_USER_PASSWORD"] = "INFLUXDB_WRITE_USER_PASSWORD"
+
+
+def test_init_with_conf():
+    conf = DBConfig("host", 1234, "user_name", "database", "write_user_pw")
+    Uploader(conf)
+
+
+def test_load_conf():
+    setup_env()
+
+    conf = load_config_from_env()
+    assert conf.host == os.environ["INFLUXDB_HOST"]
+    assert conf.port == os.environ["INFLUXDB_PORT"]
+    assert conf.user_name == os.environ["INFLUXDB_USER_NAME"]
+    assert conf.database == os.environ["INFLUXDB_DATABASE"]
+    assert conf.write_user_pw == os.environ["INFLUXDB_WRITE_USER_PASSWORD"]
+
+    Uploader(conf)
+
+
+def test_init_from_env():
+    setup_env()
+    Uploader()