コード例 #1
0
    def test__create_classes_with_primitives(self):
        """
        Test the `_create_classes_with_primitives` method.
        """

        schema = Schema(Mock())

        mock_primitive = Mock()
        schema._create_class_with_premitives = mock_primitive

        schema._create_classes_with_primitives(list("Test!!"))
        self.assertEqual(mock_primitive.call_count, 6)
コード例 #2
0
    def test_create(self):
        """
        Test the `create` method.
        """

        schema = Schema(Mock())

        # mock function calls
        mock_primitive = Mock()
        mock_complex = Mock()
        schema._create_classes_with_primitives = mock_primitive
        schema._create_complex_properties_from_classes = mock_complex

        schema.create("test/schema/schema_company.json")  # with read from file

        mock_primitive.assert_called_with(schema_company_local["classes"])
        mock_complex.assert_called_with(schema_company_local["classes"])