|
@@ -28,80 +28,26 @@ sub test_user {
|
28
|
28
|
$this->{config}{Authentification}{Email},
|
29
|
29
|
$this->{config}{Authentification}{Username},
|
30
|
30
|
$this->{config}{Authentification}{Password} );
|
31
|
|
- $this->test_user_authentification( $user1_index );
|
32
|
|
- $this->test_user_already_created( $user1_index );
|
33
|
|
-
|
|
31
|
+ $this->{tester}->test_user_authentification(
|
|
32
|
+ $this->{users}[$user1_index]);
|
|
33
|
+ $this->{tester}->test_user_already_created(
|
|
34
|
+ $this->{users}[$user1_index]);
|
34
|
35
|
my $user2_index = $this->add_user(
|
35
|
36
|
$this->{config}{User}{Email},
|
36
|
37
|
$this->{config}{User}{Username},
|
37
|
38
|
$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 );
|
44
|
|
-}
|
45
|
|
-
|
46
|
|
-sub test_user_authentification {
|
47
|
|
- my ($this, $index) = @_;
|
48
|
|
- my $auth = $this->{users}[ $index ]->authentification;
|
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' );
|
68
|
|
-}
|
69
|
|
-
|
70
|
|
-sub test_user_create {
|
71
|
|
- my ($this, $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;
|
89
|
|
-}
|
90
|
|
-
|
91
|
|
-sub test_user_already_created {
|
92
|
|
- my ($this, $index) = @_;
|
93
|
|
- my $creation = $this->create_user( $index );
|
94
|
|
- return $this->{tester}->assertNotEqual( $creation, "422 Unprocessable Entity");
|
95
|
|
-}
|
96
|
|
-
|
97
|
|
-sub create_user {
|
98
|
|
- my ($this, $index) = @_;
|
99
|
|
- return $this->{users}[ $index ]->create;
|
100
|
|
-}
|
101
|
|
-
|
102
|
|
-sub remove_user {
|
103
|
|
- my ($this, $index) = @_;
|
104
|
|
- return $this->{users}[ $index ]->remove;
|
|
39
|
+ $this->{tester}->test_user_not_exists(
|
|
40
|
+ $this->{users}[$user2_index]);
|
|
41
|
+ $this->{tester}->test_user_create(
|
|
42
|
+ $this->{users}[$user2_index]);
|
|
43
|
+ $this->{tester}->test_user_exists(
|
|
44
|
+ $this->{users}[$user2_index]);
|
|
45
|
+ $this->{tester}->test_user_remove(
|
|
46
|
+ $this->{users}[$user2_index]);
|
|
47
|
+ $this->{tester}->test_user_removed(
|
|
48
|
+ $this->{users}[$user2_index]);
|
|
49
|
+ $this->{tester}->test_user_already_removed(
|
|
50
|
+ $this->{users}[$user2_index]);
|
105
|
51
|
}
|
106
|
52
|
|
107
|
53
|
sub add_user {
|