1. Ludia
  2. Untitled project
  3. dynamodb-mock

Commits

Jean-Tiare Le Bigot  committed 5b9d5f3

add missing test file; update changelog; close #1 task

  • Participants
  • Parent commits 4c29d9f
  • Branches default

Comments (0)

Files changed (4)

File CHANGES.rst

View file
  • Ignore whitespace
-===========
-ddbmock 0.3
-===========
+=================
+ddbmock 0.3.1.dev
+=================
+
+This section documents all user visible changes included between ddbmock
+versions 0.3.0 and versions 0.3.1.dev
+
+Additions
+---------
+
+- add basic tests for pyramid entry-point (#1)
+
+Changes
+-------
+
+- accurate table statuses
+
+=============
+ddbmock 0.3.0
+=============
 
 Initial ddbmock release. This is *alpha quality* sofware. Some
 import features such as "Excusive Start Key", "Reverse" and

File docs/conf.py

View file
  • Ignore whitespace
 # The short X.Y version.
 version = '0.3'
 # The full version, including alpha/beta/rc tags.
-release = '0.3.0'
+release = '0.3.1.dev'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

File setup.cfg

View file
  • Ignore whitespace
 [metadata]
 name = ddbmock
-version = 0.3.0
+version = 0.3.1.dev
 summary = Amazon DynamoDB mock implementation
 description-file = README.rst
 author = Jean-Tiare Le Bigot

File tests/functional/pyramid/test_list_tables.py

View file
  • Ignore whitespace
+# -*- coding: utf-8 -*-
+
+import unittest, json
+
+TABLE_NAME1 = 'Table-1'
+TABLE_NAME2 = 'Table-2'
+
+HEADERS = {
+    'x-amz-target': 'DynamoDB_20111205.ListTables',
+    'content-type': 'application/x-amz-json-1.0',
+}
+
+class TestListTables(unittest.TestCase):
+    def setUp(self):
+        from ddbmock.database.db import DynamoDB
+        from ddbmock.database.table import Table
+        from ddbmock.database.key import PrimaryKey
+
+        from ddbmock import main
+        app = main({})
+        from webtest import TestApp
+        self.app = TestApp(app)
+
+        db = DynamoDB()
+        db.hard_reset()
+
+        hash_key = PrimaryKey('hash_key', 'N')
+        range_key = PrimaryKey('range_key', 'S')
+
+        t1 = Table(TABLE_NAME1, 10, 10, hash_key, range_key)
+        t2 = Table(TABLE_NAME2, 10, 10, hash_key, range_key)
+
+        db.data[TABLE_NAME1] = t1
+        db.data[TABLE_NAME2] = t2
+
+    def tearDown(self):
+        from ddbmock.database.db import DynamoDB
+        DynamoDB().hard_reset()
+
+    def test_list_tables(self):
+        from ddbmock import connect_boto
+        db = connect_boto()
+
+        request = {}
+
+        expected = {
+            "TableNames": [TABLE_NAME1, TABLE_NAME2],
+        }
+
+        res = self.app.post_json('/', request, HEADERS, status=200)
+        self.assertEqual(expected, json.loads(res.body))
+        self.assertEqual('application/x-amz-json-1.0; charset=UTF-8', res.headers['Content-Type'])
+