Create a new v3 based object for to test update() with Context

This commit is contained in:
Eric A. Miller
2018-03-27 21:53:05 -04:00
parent cbc756a3f8
commit 8b3b03b312

View File

@@ -76,12 +76,6 @@ sub update : Tests(9) {
# Starting community # Starting community
is($test->{info}{sess}{Community}, 'public', q(Original community 'public')); is($test->{info}{sess}{Community}, 'public', q(Original community 'public'));
# Starting context
ok(!exists $test->{info}{sess}{Context}, q(Context doesn't exist));
#TODO: {
# todo_skip "CI issues with update() tests", 6 if 1;
# Change community # Change community
my %update_args = ('Community' => 'new_community',); my %update_args = ('Community' => 'new_community',);
delete $test->{info}{args}{Session}; delete $test->{info}{args}{Session};
@@ -89,12 +83,31 @@ sub update : Tests(9) {
is($test->{info}->error(), undef, '... and no error'); is($test->{info}->error(), undef, '... and no error');
is($test->{info}{sess}{Community}, 'new_community', 'Community changed'); is($test->{info}{sess}{Community}, 'new_community', 'Community changed');
#TODO: {
# todo_skip "CI issues with update() tests", 3 if 1;
my $class = $test->class;
my $v3_info = $class->new(
'AutoSpecify' => 0,
'BulkWalk' => 0,
'UseEnums' => 1,
'RetryNoSuch' => 1,
'DestHost' => '127.0.0.1',
'SecName' => 'initial',
'SecLevel' => 'noAuthNoPriv',
'Context' => '',
'Version' => 3,
);
# Starting context
is($v3_info->{sess}{Context}, '', q(Context doesn't exist));
# Change context # Change context
$test->{info}{args}{Version} = 3; %update_args = ('Context' => 'vlan-100');
%update_args = ('Context' => 'new_context',); ok($v3_info->update(%update_args), 'Update Context');
ok($test->{info}->update(%update_args), 'Update Context'); is($v3_info->error(), undef, '... and no error');
is($test->{info}->error(), undef, '... and no error'); is($v3_info->{sess}{Context}, 'vlan-100', 'Context changed');
is($test->{info}{sess}{Context}, 'new_context', 'Context changed');
# } # }
} }