#!/usr/local/cpanel/3rdparty/bin/perl -w

#                                      Copyright 2025 WebPros International, LLC
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

package t::medium::Cpanel::Xovi::User;

use cPstrict;
use Test::Cpanel::Policy;

use Test2::V0;
use Test2::Tools::Explain;
use Test2::Tools::Compare;
use Test2::Plugin::NoWarnings;
use Test2::Tools::Exception;
use Test::MockModule;
use Test::MockFile;

use Cpanel::Xovi::User ();

use base qw(Test::Class);

__PACKAGE__->new()->runtests() if !caller;

#----------------------------------------------------------------------

sub test_create_user : Tests(4) {
    my $mock_adminBin = Test::MockModule->new('Cpanel::AdminBin::Call');
    my ( $namespace, $module, $method );
    my $fake_apiKey   = '12135abcgd67';
    my $expected_data = { 'apiToken' => $fake_apiKey };
    $mock_adminBin->redefine( 'call' => sub { ( $namespace, $module, $method ) = @_; return $fake_apiKey; } );

    my $output_data = Cpanel::Xovi::User::create_user();
    is( $namespace,   'Cpanel',       "The expected namespace is $namespace" );
    is( $module,      'xovi',         "The expected module is $module" );
    is( $method,      'CREATE_USER',  "The expected method is $method" );
    is( $output_data, $expected_data, "We are receiving the expected data." );

}

1;
