|
@@ -34,19 +34,58 @@ sub test_user {
|
34
|
34
|
my $user2_index = $this->add_user(
|
35
|
35
|
$this->{config}{User}{Email},
|
36
|
36
|
$this->{config}{User}{Username},
|
37
|
|
- $this->{config}{User}{Password} );
|
38
|
|
- return $this->test_user_create( $user2_index );
|
|
37
|
+ $this->{config}{User}{Password} );
|
|
38
|
+ $this->test_user_not_exists( $user2_index );
|
|
39
|
+ $this->test_user_create( $user2_index );
|
|
40
|
+ $this->test_user_exists( $user2_index );
|
|
41
|
+ $this->test_user_remove( $user2_index );
|
|
42
|
+ $this->test_user_removed( $user2_index );
|
|
43
|
+ $this->test_user_already_removed( $user2_index );
|
39
|
44
|
}
|
40
|
45
|
|
41
|
46
|
sub test_user_authentification {
|
42
|
47
|
my ($this, $index) = @_;
|
43
|
48
|
my $auth = $this->{users}[ $index ]->authentification;
|
44
|
|
- return $this->{tester}->assertEqual( $auth->{email}, $this->{config}{Authentification}{Email} );
|
|
49
|
+ return $this->{tester}->assertEqual( $auth->{email}, $this->{users}[ $index ]->{email} );
|
|
50
|
+}
|
|
51
|
+
|
|
52
|
+sub test_user_exists {
|
|
53
|
+ my ($this, $index) = @_;
|
|
54
|
+ my $user = $this->{users}[ $index ]->fetch;
|
|
55
|
+ return $this->{tester}->assertEqual( $user->{data}{attributes}{email}, $this->{users}[ $index ]->{email} );
|
|
56
|
+}
|
|
57
|
+
|
|
58
|
+sub test_user_not_exists {
|
|
59
|
+ my ($this, $index) = @_;
|
|
60
|
+ my $user = $this->{users}[ $index ]->fetch();
|
|
61
|
+ return $this->{tester}->assertEqual( $user, 0 );
|
|
62
|
+}
|
|
63
|
+
|
|
64
|
+sub test_user_removed {
|
|
65
|
+ my ($this, $index) = @_;
|
|
66
|
+ my $user = $this->{users}[ $index ]->fetch();
|
|
67
|
+ return $this->{tester}->assertEqual( $user, '404 Not Found' );
|
45
|
68
|
}
|
46
|
69
|
|
47
|
70
|
sub test_user_create {
|
48
|
71
|
my ($this, $index) = @_;
|
49
|
|
- return $this->create_user( $index );
|
|
72
|
+ my $creation = $this->{users}[ $index ]->create();
|
|
73
|
+ return $this->{tester}->assertEqual( $creation->{data}{attributes}{email}, $this->{users}[ $index ]->{email} );
|
|
74
|
+}
|
|
75
|
+
|
|
76
|
+sub test_user_already_removed {
|
|
77
|
+ my ($this, $index) = @_;
|
|
78
|
+ return $this->{tester}->assertEqual($this->remove_user( $index ), '404 Not Found');
|
|
79
|
+}
|
|
80
|
+
|
|
81
|
+sub test_user_remove {
|
|
82
|
+ my ($this, $index) = @_;
|
|
83
|
+ return $this->{tester}->assertEqual($this->remove_user( $index ), '204 No Content');
|
|
84
|
+}
|
|
85
|
+
|
|
86
|
+sub remove_user {
|
|
87
|
+ my ($this, $index) = @_;
|
|
88
|
+ return $this->{users}[ $index ]->remove;
|
50
|
89
|
}
|
51
|
90
|
|
52
|
91
|
sub test_user_already_created {
|
|
@@ -60,6 +99,11 @@ sub create_user {
|
60
|
99
|
return $this->{users}[ $index ]->create;
|
61
|
100
|
}
|
62
|
101
|
|
|
102
|
+sub remove_user {
|
|
103
|
+ my ($this, $index) = @_;
|
|
104
|
+ return $this->{users}[ $index ]->remove;
|
|
105
|
+}
|
|
106
|
+
|
63
|
107
|
sub add_user {
|
64
|
108
|
my ($this, $email, $username, $password) = @_ ;
|
65
|
109
|
push(
|
|
@@ -71,7 +115,7 @@ sub add_user {
|
71
|
115
|
sub run {
|
72
|
116
|
my $this = shift;
|
73
|
117
|
$this->test_rq_empty();
|
74
|
|
- return $this->test_user();
|
|
118
|
+ $this->test_user();
|
75
|
119
|
$this->brief();
|
76
|
120
|
}
|
77
|
121
|
|