Beispiel #1
0
    def test_init(self):
        """Test successful Dict Field initialization"""

        add_info = Auto()
        assert add_info is not None

        value = add_info._load(1)
        assert value == 1
Beispiel #2
0
    def __create_id_field(new_class):
        """Create and return a default ID field that is Auto generated"""
        id_field = Auto(identifier=True)

        setattr(new_class, "id", id_field)
        id_field.__set_name__(new_class, "id")

        setattr(new_class, _ID_FIELD_NAME, id_field.field_name)

        field_objects = getattr(new_class, _FIELDS)
        field_objects["id"] = id_field
        setattr(new_class, _FIELDS, field_objects)
Beispiel #3
0
class PersonAdded(BaseEvent):
    id = Auto(identifier=True)
    first_name = String(max_length=50, required=True)
    last_name = String(max_length=50, required=True)
    age = Integer(default=21)

    class Meta:
        aggregate_cls = Person
Beispiel #4
0
class PersonAutoSSN(BaseView):
    ssn = Auto(identifier=True)
    first_name = String(max_length=50, required=True)
    last_name = String(max_length=50)
    age = Integer(default=21)
Beispiel #5
0
 class AutoTest(BaseView):
     identifier = Auto(identifier=True)
     auto_field1 = Auto()
Beispiel #6
0
 class AutoTest(BaseAggregate):
     auto_field = Auto(identifier=True)
Beispiel #7
0
 class AutoTest(BaseAggregate):
     auto_field = Auto(increment=True)
Beispiel #8
0
 class AutoTest(BaseAggregate):
     auto_field1 = Auto()
     auto_field2 = Auto()
Beispiel #9
0
 def test_validation(self):
     """Test validation for the Auto Field"""
     add_info = Auto(required=True)
     add_info._load(None)
Beispiel #10
0
 def test_that_auto_fields_that_are_identifiers_are_also_unique(self):
     message_id = Auto(identifier=True)
     assert message_id.identifier is True
     assert message_id.unique is True
Beispiel #11
0
class PersonAutoSSN(BaseAggregate):
    ssn = Auto(identifier=True)
    name = String(max_length=25)