Skip to content

Commit

Permalink
Minor enhancement.
Browse files Browse the repository at this point in the history
- Default label to supplied region
- Update documentation
- Add more test cases
- Update changelog file
- Update make file to use specific mock
- Bump up version
- Update generated documentation to latest
  • Loading branch information
rickypc committed Jul 30, 2015
1 parent c0ec81c commit 05f822c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.0.14 (2015.07.29)
===================

* Default label to supplied region
* Update documentation
* Add more test cases

0.0.13 (2015.07.22)
===================

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ version:

install_devel_deps:
pip install -e .
pip install coverage mock
pip install coverage mock==1.0.1

download:
ifeq ($(CURL),)
Expand Down
4 changes: 2 additions & 2 deletions doc/DynamoDBSQLLibrary.html

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/DynamoDBSQLLibrary/keywords/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ def create_dynamodb_session(self, *args, **kwargs):
:param bool `is_secure`: Enforce https connection. (Default True)
:param str `label`: Session label, a case and space insensitive string.
:param str `label`: Session label, a case and space insensitive string. (Default :param str `region`)
Examples:
| Create DynamoDB Session | region=us-west-1 | access_key=KEY | secret_key=SECRET | label=LABEL |
| Create DynamoDB Session | us-west-1 | access_key=KEY | secret_key=SECRET | | # Label is us-west-1 |
| Create DynamoDB Session | us-west-1 | access_key=KEY | secret_key=SECRET | label=LABEL | # Label is LABEL |
"""
# pylint: disable=line-too-long
label = kwargs.pop('label', self._string.generate_random_string(32))
kargs = dict(enumerate(args))
label = kwargs.pop('label', kargs.get(0, self._string.generate_random_string(32)))
self._builtin.log('Creating DynamoDB session: %s' % label, 'DEBUG')
session = Engine()
session.connect(*args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoDBSQLLibrary/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Amazon DynamoDB SQL Library - an Amazon DynamoDB testing library with SQL-like DSL.
"""

VERSION = '0.0.13'
VERSION = '0.0.14'


def get_version():
Expand Down
19 changes: 16 additions & 3 deletions test/utest/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,24 @@ def test_class_should_initiate(self):

def test_create_should_register_new_session(self):
"""Create session should successfully register new session."""
self.session.create_dynamodb_session(self.region, label=self.label)
label = self.session.create_dynamodb_session(self.region, label=self.label)
self.assertEqual(label, self.label)
self.assertNotEqual(label, self.region)
try:
self.session._cache.switch(self.label)
self.session._cache.switch(label)
except RuntimeError:
self.fail("Label '%s' should be exist." % label)
self.session.delete_all_dynamodb_sessions()

def test_create_should_register_with_region_as_label(self):
"""Create session should successfully register new session with region as default label."""
label = self.session.create_dynamodb_session(self.region)
self.assertNotEqual(label, self.label)
self.assertEqual(label, self.region)
try:
self.session._cache.switch(label)
except RuntimeError:
self.fail("Label '%s' should be exist." % self.label)
self.fail("Label '%s' should be exist." % label)
self.session.delete_all_dynamodb_sessions()

def test_delete_should_remove_all_sessions(self):
Expand Down

0 comments on commit 05f822c

Please sign in to comment.