コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 def test_create_test_model_populates_string_properties(self):
     self.test_model = unittestutils.generateTestModelInstance(TestClassModel)
     self.assertTrue(self.test_model.typicalStringProp is not None)
コード例 #4
0
 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)
コード例 #5
0
 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)
コード例 #6
0
 def test_create_test_model_instance_is_right_type(self):
     self.test_model = unittestutils.generateTestModelInstance(TestClassModel)
     self.assertTrue(isinstance(self.test_model, TestClassModel))
コード例 #7
0
 def test_create_test_model_instance_doesnt_return_null(self):
     self.test_model = unittestutils.generateTestModelInstance(TestClassModel)
     self.assertTrue(self.test_model is not None)