Exemplo n.º 1
0
    def test_create_command(self):
        """Test the sync_pgfunctions command.
        """
        management.call_command('sync_pgfunctions', *[], **{})

        # Check it was created
        cursor_wrapper = connection.cursor()
        cursor = cursor_wrapper.cursor
        self.assertEqual(_function_exists(cursor, 'user_type'), True)
Exemplo n.º 2
0
    def test_create_functions_from_models(self):
        """Create functions using the create_functions and passing the models
        module.
        """
        create_result = create_functions(models)

        for status, _, _ in create_result:
            self.assertEqual(status, 'CREATED')

        # Now check it was created
        cursor_wrapper = connection.cursor()
        cursor = cursor_wrapper.cursor
        self.assertEqual(_function_exists(cursor, 'user_type'), True)