summaryrefslogtreecommitdiff
path: root/t/features/step_definitions/modify_steps.pl
blob: 6e6e92da3248b3e00013a20aee49d31aba6ba092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/perl

use strict;
use warnings;
  
use Test::More;
use Test::BDD::Cucumber::StepFile;

our %TestConfig = %main::TestConfig;

use Data::Dumper;

When qr/I've (asynchronously )?added a new attribute to the new entry/i, sub {
  my $async = $1 ? 1 : 0;
  
  S->{'new attribute_result'} = 'skipped';

  return if S->{'bind_result'} eq 'skipped';

  my $func = 'modify_ext_s';
  my %args = ();
  
  if ($async) {
    $func = 'modify_ext';
  }
  S->{'new attribute_async'} = $async;
  
  $args{'-dn'} = sprintf('%s,%s,%s', $TestConfig{'data'}{'entry_dn'}, $TestConfig{'data'}{'test_container_dn'}, $TestConfig{'ldap'}{'base_dn'});
  $args{'-mod'} = $TestConfig{'modify'}{'new_attribute'};
 
  S->{'new attribute_result'} = S->{'object'}->$func(%args);
};

When qr/I've (asynchronously )?modified the new attribute on the new entry/i, sub {
  my $async = $1 ? 1 : 0;
  
  S->{'modified attribute_result'} = 'skipped';

  return if S->{'bind_result'} eq 'skipped';

  my $func = 'modify_s';
  my %args = ();
  
  if ($async) {
    $func = 'modify';
  }
  S->{'modified attribute_async'} = $async;
  
  $args{'-dn'} = sprintf('%s,%s,%s', $TestConfig{'data'}{'entry_dn'}, $TestConfig{'data'}{'test_container_dn'}, $TestConfig{'ldap'}{'base_dn'});
  $args{'-mod'} = $TestConfig{'modify'}{'modify_attribute'};
 
  S->{'modified attribute_result'} = S->{'object'}->$func(%args);
};

When qr/I've (asynchronously )?removed the new attribute from the new entry/i, sub {
  my $async = $1 ? 1 : 0;
  
  S->{'removed attribute_result'} = 'skipped';

  return if S->{'bind_result'} eq 'skipped';

  my $func = 'modify_s';
  my %args = ();
  
  if ($async) {
    $func = 'modify';
  }
  S->{'removed attribute_async'} = $async;
  
  $args{'-dn'} = sprintf('%s,%s,%s', $TestConfig{'data'}{'entry_dn'}, $TestConfig{'data'}{'test_container_dn'}, $TestConfig{'ldap'}{'base_dn'});
  $args{'-mod'} = $TestConfig{'modify'}{'remove_attribute'};
 
  S->{'removed attribute_result'} = S->{'object'}->$func(%args);
};

1;