16
16
* @coversDefaultClass \Activitypub\Signature
17
17
*/
18
18
class Test_Signature extends \WP_UnitTestCase {
19
+ /**
20
+ * Tear down.
21
+ */
22
+ public function tear_down () {
23
+ parent ::tear_down ();
24
+ \delete_option ( 'activitypub_keypair_for_0 ' );
25
+ \delete_option ( 'activitypub_keypair_for_-1 ' );
26
+ \delete_option ( 'activitypub_keypair_for_admin ' );
27
+ \delete_option ( 'activitypub_blog_user_public_key ' );
28
+ \delete_option ( 'activitypub_blog_user_private_key ' );
29
+ \delete_option ( 'activitypub_application_user_public_key ' );
30
+ \delete_option ( 'activitypub_application_user_private_key ' );
31
+ \delete_option ( 'activitypub_actor_mode ' );
32
+ \delete_user_meta ( 1 , 'magic_sig_public_key ' );
33
+ \delete_user_meta ( 1 , 'magic_sig_private_key ' );
34
+ }
19
35
20
36
/**
21
37
* Test signature creation.
@@ -45,6 +61,8 @@ public function test_signature_legacy() {
45
61
// Check user.
46
62
$ user = Actors::get_by_id ( 1 );
47
63
64
+ \delete_option ( 'activitypub_keypair_for_admin ' );
65
+
48
66
$ public_key = 'public key ' . $ user ->get__id ();
49
67
$ private_key = 'private key ' . $ user ->get__id ();
50
68
@@ -60,11 +78,13 @@ public function test_signature_legacy() {
60
78
// Check application user.
61
79
$ user = Actors::get_by_id ( Actors::APPLICATION_USER_ID );
62
80
81
+ \delete_option ( 'activitypub_keypair_for_-1 ' );
82
+
63
83
$ public_key = 'public key ' . $ user ->get__id ();
64
84
$ private_key = 'private key ' . $ user ->get__id ();
65
85
66
- add_option ( 'activitypub_application_user_public_key ' , $ public_key );
67
- add_option ( 'activitypub_application_user_private_key ' , $ private_key );
86
+ \ add_option ( 'activitypub_application_user_public_key ' , $ public_key );
87
+ \ add_option ( 'activitypub_application_user_private_key ' , $ private_key );
68
88
69
89
$ key_pair = Signature::get_keypair_for ( $ user ->get__id () );
70
90
@@ -80,8 +100,10 @@ public function test_signature_legacy() {
80
100
$ public_key = 'public key ' . $ user ->get__id ();
81
101
$ private_key = 'private key ' . $ user ->get__id ();
82
102
83
- add_option ( 'activitypub_blog_user_public_key ' , $ public_key );
84
- add_option ( 'activitypub_blog_user_private_key ' , $ private_key );
103
+ \delete_option ( 'activitypub_keypair_for_0 ' );
104
+
105
+ \add_option ( 'activitypub_blog_user_public_key ' , $ public_key );
106
+ \add_option ( 'activitypub_blog_user_private_key ' , $ private_key );
85
107
86
108
$ key_pair = Signature::get_keypair_for ( $ user ->get__id () );
87
109
0 commit comments