Permalink
Browse files

Added test to ensure arguments overwrote config file passed in args.

  • Loading branch information...
1 parent 4cd415d commit e0eb7aea420a1d2cf34d962e3fc62def7d02fdbd @paddyforan paddyforan committed May 1, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 test.py
View
28 test.py
@@ -167,6 +167,34 @@ def test_fromArgsConfigFileMixed(self):
os.remove("test_config.json")
+ def test_fromArgsAndArgsConfigFile(self):
+ test_config = {
+ "host": "test-config-host",
+ "protocol": "test-config-protocol",
+ "port": "test-config-port",
+ "api_version": "test-config-api-version",
+ "project_id": "test-config-project-id",
+ "token": "test-config-token"
+ }
+
+ file = open("test_config.json", "w")
+ file.write(json.dumps(test_config))
+ file.close()
+
+ client = iron_core.IronClient(name="Test", version="0.1.0",
+ product="iron_worker", config_file="test_config.json",
+ project_id="test-project-id-args",
+ token="test-token-args")
+
+ self.assertEqual(client.host, test_config["host"])
+ self.assertEqual(client.protocol, test_config["protocol"])
+ self.assertEqual(client.port, test_config["port"])
+ self.assertEqual(client.api_version, test_config["api_version"])
+ self.assertEqual(client.project_id, "test-project-id-args")
+ self.assertEqual(client.token, "test-token-args")
+
+ os.remove("test_config.json")
+
if __name__ == "__main__":
unittest.main()

0 comments on commit e0eb7ae

Please sign in to comment.