def test_create_test_model_populates_string_properties_within_values_array(self): restricted_values = [unittestutils.generateRandomString(), unittestutils.generateRandomString(), unittestutils.generateRandomString()] self.test_model = unittestutils.generateTestModelInstance(TestClassModel, { 'typicalStringProp': StringGenerationValueRestriction(restricted_values)}) self.assertTrue(self.test_model.typicalStringProp in restricted_values)
def test_create_test_model_populates_string_properties_within_length_restrictions(self): self.test_model = unittestutils.generateTestModelInstance(TestClassModel, {'typicalStringProp': StringGenerationLengthRestriction(1, 2)}) self.assertTrue(len(self.test_model.typicalStringProp) > 0 and len(self.test_model.typicalStringProp) < 3)
def test_create_test_model_populates_string_properties(self): self.test_model = unittestutils.generateTestModelInstance(TestClassModel) self.assertTrue(self.test_model.typicalStringProp is not None)
def test_create_test_model_populates_integer_property_within_restricted_range(self): self.test_model = unittestutils.generateTestModelInstance(TestClassModel, {'typicalIntProp': IntegerGenerationRestriction(1, 2)}) self.assertTrue(self.test_model.typicalIntProp > 0 and self.test_model.typicalIntProp < 3)
def test_create_test_model_populates_integer_property_with_defaults(self): self.test_model = unittestutils.generateTestModelInstance(TestClassModel) self.assertTrue(self.test_model.typicalIntProp > 0 and self.test_model.typicalIntProp <= 100)
def test_create_test_model_instance_is_right_type(self): self.test_model = unittestutils.generateTestModelInstance(TestClassModel) self.assertTrue(isinstance(self.test_model, TestClassModel))
def test_create_test_model_instance_doesnt_return_null(self): self.test_model = unittestutils.generateTestModelInstance(TestClassModel) self.assertTrue(self.test_model is not None)