Esempio n. 1
0
    def it_can_overwrite_files(model_class, instance):
        instance.__mapper__.create()

        utilities.create(model_class, 'foo', 'bar', overwrite=True)
Esempio n. 2
0
 def it_requires_a_mapped_class_or_instance():
     with expect.raises(TypeError):
         utilities.create(Mock)
Esempio n. 3
0
    def it_creates_files(model_class):
        instance = utilities.create(model_class, 'foo', 'bar')

        expect(instance.__mapper__.exists) == True
Esempio n. 4
0
    def it_requires_files_to_not_yet_exist(model_class, instance):
        instance.__mapper__.create()

        with expect.raises(exceptions.DuplicateMappingError):
            utilities.create(model_class, 'foo', 'bar')
Esempio n. 5
0
 def create(cls, *args, **kwargs):
     return utilities.create(cls, *args, **kwargs)
Esempio n. 6
0
    def it_supports_keyword_arguments(model_class):
        instance = utilities.create(model_class, 'foo', key='bar')

        expect(instance.__mapper__.exists) == True
Esempio n. 7
0
 def new(cls, *args, **kwargs):
     msg = "ModelMixin.new() has been renamed to ModelMixin.create()"
     warnings.warn(msg, DeprecationWarning)
     return utilities.create(cls, *args, **kwargs)
Esempio n. 8
0
 def it_requires_a_mapped_class_or_instance():
     with expect.raises(TypeError):
         utilities.create(Mock)
Esempio n. 9
0
    def it_can_overwrite_files(model_class, instance):
        instance.__mapper__.create()

        utilities.create(model_class, 'foo', 'bar', overwrite=True)
Esempio n. 10
0
    def it_requires_files_to_not_yet_exist(model_class, instance):
        instance.__mapper__.create()

        with expect.raises(exceptions.DuplicateMappingError):
            utilities.create(model_class, 'foo', 'bar')
Esempio n. 11
0
    def it_creates_files(model_class):
        instance = utilities.create(model_class, 'foo', 'bar')

        expect(instance.__mapper__.exists) == True