Commits

Max Noel  committed c3d8e1d Draft

* Version 1.8.1

  • Participants
  • Parent commits e45ae24
  • Tags 1.8.1

Comments (0)

Files changed (2)

File dynamodb_mapper/tests/test_model.py

         "scores": [InRange(min=0, max=100)],
     }
 
+class SchemaValidatorsCoerceLong(DynamoDBModel):
+    __table__ = "SchemaValidatorsCoerceLong"
+    __hash_key__ = "id"
+    __schema__ = {
+        "id": Coerce(long),
+    }
+
 class SchemaValidatorsBad(DynamoDBModel):
     __table__ = "SchemaValidatorsBad"
     __hash_key__ = "name"
 
         table.refresh.assert_called_once_with(wait_for_active=True)
 
+    @mock.patch("dynamodb_mapper.model.boto")
+    def test_create_table_validators_coerce_long(self, m_boto):
+        # Issue #20.
+        m_connection = m_boto.connect_dynamodb.return_value
+        m_create_schema = m_connection.create_schema
+        m_create_table = m_connection.create_table
+
+        table = ConnectionBorg().create_table(
+            SchemaValidatorsCoerceLong, 10, 5, True)
+
+        m_create_schema.assert_called_once_with(
+            hash_key_name=SchemaValidatorsCoerceLong.__hash_key__,
+            hash_key_proto_value=0L,
+            range_key_name=None,
+            range_key_proto_value=None,
+        )
+
+        m_create_table.assert_called_once_with(
+            SchemaValidatorsCoerceLong.__table__, m_create_schema.return_value, 10, 5)
+
+        table.refresh.assert_called_once_with(wait_for_active=True)
+
 
 class TestTypeConversions(unittest.TestCase):
     def test_python_to_dynamodb_number(self):
 [metadata]
 name = dynamodb-mapper
-version = 1.8.0
+version = 1.8.1
 summary = Object mapper for Amazon DynamoDB
 description-file = README.rst
 author = Max Noel