Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing config class to set api_key again. Reverted HEAD back and wipe…

…d out config class changes.
  • Loading branch information...
commit 149df0aca28f5790cae9dd9e5d2d8519b47c2fdc 1 parent 211621e
Chavez authored
10 al_papi/config.py
View
@@ -6,7 +6,15 @@ class Config(object):
"""
default_host = "http://api.authoritylabs.com"
port = 80
-
+
+ @staticmethod
+ def setup(api_key):
+ Config.api_key = api_key
+
+ @staticmethod
+ def create():
+ return Config(Config.api_key)
+
def __init__(self, api_key):
self.api_key = api_key
25 tests/test_helper.py
View
@@ -14,19 +14,20 @@
from nose.tools import raises
from random import randint
+Config("my-api-key")
class TestHelper(object):
- @staticmethod
- def includes(collection, expected):
- for item in collection.items:
- if item.id == expected.id:
- return True
- return False
+ @staticmethod
+ def includes(collection, expected):
+ for item in collection.items:
+ if item.id == expected.id:
+ return True
+ return False
- @staticmethod
- def in_list(collection, expected):
- for item in collection:
- if item == expected:
- return True
- return False
+ @staticmethod
+ def in_list(collection, expected):
+ for item in collection:
+ if item == expected:
+ return True
+ return False
9 tests/unit/test_config.py
View
@@ -6,8 +6,11 @@ def setUp(self):
self.config = Config("api-key")
def test_default_host(self):
- assert_equal("http://api.authoritylabs.com", self.config.default_host)
+ assert_equal("http://api.authoritylabs.com", self.config.default_host)
def test_default_port(self):
- assert_equal(80, self.config.port)
-
+ assert_equal(80, self.config.port)
+
+ def test_setup(self):
+ Config.setup("my-api-key")
+ assert_equal("my-api-key", Config.api_key)
Please sign in to comment.
Something went wrong with that request. Please try again.