|
@@ -24,26 +24,40 @@ sub test_rq_empty {
|
24
|
24
|
|
25
|
25
|
sub test_user {
|
26
|
26
|
my $this = shift;
|
27
|
|
- return $this->test_user_authentification;
|
|
27
|
+ my $user1_index = $this->add_user(
|
|
28
|
+ $this->{config}{Authentification}{Email},
|
|
29
|
+ $this->{config}{Authentification}{Username},
|
|
30
|
+ $this->{config}{Authentification}{Password} );
|
|
31
|
+ $this->test_user_authentification( $user1_index );
|
|
32
|
+
|
|
33
|
+ my $user2_index = $this->add_user(
|
|
34
|
+ $this->{config}{User}{Email},
|
|
35
|
+ $this->{config}{User}{Username},
|
|
36
|
+ $this->{config}{User}{Password} );
|
|
37
|
+ return $this->test_user_create( $user2_index );
|
28
|
38
|
}
|
29
|
39
|
|
30
|
40
|
sub test_user_authentification {
|
31
|
|
- my $this = shift;
|
32
|
|
- my $index = $this->add_user(
|
33
|
|
- $this->{config}{Authentification}{Email},
|
34
|
|
- $this->{config}{Authentification}{Password} );
|
|
41
|
+ my ($this, $index) = @_;
|
35
|
42
|
my $auth = $this->{users}[ $index ]->authentification;
|
36
|
43
|
return $this->{tester}->assertEqual( $auth->{email}, $this->{config}{Authentification}{Email} );
|
37
|
44
|
}
|
38
|
45
|
|
|
46
|
+sub test_user_create {
|
|
47
|
+ my ($this, $index) = @_;
|
|
48
|
+ return $this->create_user( $index );
|
|
49
|
+}
|
|
50
|
+
|
|
51
|
+sub create_user {
|
|
52
|
+ my ($this, $index) = @_; print "\ncreate user :". $this->{users}[ $index ]->{username} ."\n";
|
|
53
|
+ return $this->{users}[ $index ]->create;
|
|
54
|
+}
|
|
55
|
+
|
39
|
56
|
sub add_user {
|
40
|
|
- my ($this, $email, $password) = @_ ;
|
|
57
|
+ my ($this, $email, $username, $password) = @_ ;
|
41
|
58
|
push(
|
42
|
59
|
@{$this->{users}},
|
43
|
|
- User->new(
|
44
|
|
- $this->{config}{Authentification}{Email},
|
45
|
|
- $this->{config}{Authentification}{Password},
|
46
|
|
- $this->{tester})) ;
|
|
60
|
+ User->new( $email, $username, $password, $this->{tester})) ;
|
47
|
61
|
return $this->{users_index}++;
|
48
|
62
|
}
|
49
|
63
|
|