ADD: Versioning

This commit is contained in:
Chris Lee
2015-09-01 09:06:34 -04:00
parent ce7f97699f
commit 80760ba26b
13 changed files with 63 additions and 38 deletions
+7 -7
View File
@@ -58,11 +58,11 @@ class TestConfigurationFile(unittest.TestCase):
"""
assert self.settings.cloud() == self.cloud
def test_set_auth_from_config_file(self):
def test_set_auth_from_config_file(self):
"""
Ensure cloud authentication credentials are read in from file
"""
assert self.settings.api_key() == self.api_key
assert self.settings.api_key() == self.api_key
class TestPrecedence(unittest.TestCase):
@@ -74,7 +74,7 @@ class TestPrecedence(unittest.TestCase):
self.file_api_key = "file-api-key"
self.file_cloud = "file-cloud"
self.env_api_key = "env-api-key"
self.env_api_key = "env-api-key"
self.env_cloud = "env-cloud"
config = """
[auth]
@@ -97,12 +97,12 @@ class TestPrecedence(unittest.TestCase):
"""
assert self.settings.cloud() == self.env_cloud
def test_set_auth_from_config_file(self):
def test_set_auth_from_config_file(self):
"""
Ensure cloud authentication credentials set in environment variables
Ensure cloud authentication credentials set in environment variables
are used over those in config files
"""
assert self.settings.api_key() == self.env_api_key
assert self.settings.api_key() == self.env_api_key
class TestConfigFilePrecedence(unittest.TestCase):
@@ -154,7 +154,7 @@ class TestConfigFilePrecedence(unittest.TestCase):
"""
assert self.settings.cloud() == self.high_priority_cloud
def test_auth_config_file_priority(self):
def test_auth_config_file_priority(self):
"""
Ensure the cloud auth priority is handled properly
"""
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from indicoio import config
from indicoio import sentiment
class TestVersioning(unittest.TestCase):
def setUp(self):
self.api_key = config.api_key
def test_specify_version(self):
test_data = ['Worst song ever', 'Best song ever']
response = sentiment(test_data, api_key = self.api_key, version="1")
self.assertIsInstance(response, list)
self.assertEqual(len(response), 2)
self.assertTrue(response[0] < .5)
self.assertTrue(response[1] > .5)
if __name__ == "__main__":
unittest.main()