Skip to content

Commit

Permalink
Very beginning of the base counter implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean O'Connor committed Feb 16, 2012
1 parent 8480def commit d2db257
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Albertson.egg-info
.coverage
tests/config.ini
16 changes: 16 additions & 0 deletions albertson/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import boto


class Counter(object):
'''
Base counter class that can be used directly or overwritten as needed.
'''

def __init__(self, aws_access_key=None, aws_secret_key=None):
self.conn = self.get_conn(aws_access_key, aws_secret_key)

def get_conn(self, aws_access_key=None, aws_secret_key=None):
return boto.connect_dynamodb(
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_key,
)
7 changes: 0 additions & 7 deletions albertson/tests/base.py

This file was deleted.

3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
detailed-errors=1
with-coverage=1
cover-package=albertson
pdb=1
pdb-failures=1
tc-file=tests/config.ini
File renamed without changes.
16 changes: 16 additions & 0 deletions tests/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest

from testconfig import config

from albertson.base import Counter


class BaseCounterTests(unittest.TestCase):

def test_base_init(self):
counter = Counter(
aws_access_key=config['aws']['access_key'],
aws_secret_key=config['aws']['secret_key'],
)

counter.conn.list_tables()
3 changes: 3 additions & 0 deletions tests/config.ini.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[aws]
access_key=YOUR_AWS_ACCESS_KEY_ID
secret_key=YOUR_AWS_SECRET_KEY

0 comments on commit d2db257

Please sign in to comment.