Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Framasoft
PeerTube
PeerTube
Commits
82f33705
Verified
Commit
82f33705
authored
Dec 09, 2022
by
Chocobozzz
Browse files
Fix CI using 127.0.0.1 for tests
parent
c7c5f8d0
Changes
63
Hide whitespace changes
Inline
Side-by-side
.github/actions/reusable-prepare-peertube-run/action.yml
View file @
82f33705
...
...
@@ -9,8 +9,8 @@ runs:
shell
:
bash
run
:
|
sudo apt-get install postgresql-client-common redis-tools parallel libimage-exiftool-perl
wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.
3
.1-64bit-static.tar.xz"
tar xf ffmpeg-release-4.
3
.1-64bit-static.tar.xz
wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.
4
.1-64bit-static.tar.xz"
tar xf ffmpeg-release-4.
4
.1-64bit-static.tar.xz
mkdir -p $HOME/bin
cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
echo "$HOME/bin" >> $GITHUB_PATH
config/test-1.yaml
View file @
82f33705
...
...
@@ -2,7 +2,6 @@ listen:
port
:
9001
webserver
:
hostname
:
'
localhost'
port
:
9001
database
:
...
...
config/test-2.yaml
View file @
82f33705
...
...
@@ -2,7 +2,6 @@ listen:
port
:
9002
webserver
:
hostname
:
'
localhost'
port
:
9002
database
:
...
...
config/test-3.yaml
View file @
82f33705
...
...
@@ -2,7 +2,6 @@ listen:
port
:
9003
webserver
:
hostname
:
'
localhost'
port
:
9003
database
:
...
...
config/test-4.yaml
View file @
82f33705
...
...
@@ -2,7 +2,6 @@ listen:
port
:
9004
webserver
:
hostname
:
'
localhost'
port
:
9004
database
:
...
...
config/test-5.yaml
View file @
82f33705
...
...
@@ -2,7 +2,6 @@ listen:
port
:
9005
webserver
:
hostname
:
'
localhost'
port
:
9005
database
:
...
...
config/test-6.yaml
View file @
82f33705
...
...
@@ -2,7 +2,6 @@ listen:
port
:
9006
webserver
:
hostname
:
'
localhost'
port
:
9006
database
:
...
...
config/test.yaml
View file @
82f33705
...
...
@@ -3,6 +3,7 @@ listen:
port
:
9000
webserver
:
hostname
:
'
127.0.0.1'
https
:
false
secrets
:
...
...
@@ -20,18 +21,18 @@ rates_limit:
max
:
500
database
:
hostname
:
'
localhost
'
hostname
:
'
127.0.0.1
'
port
:
5432
redis
:
hostname
:
'
localhost
'
hostname
:
'
127.0.0.1
'
smtp
:
hostname
:
null
port
:
1025
tls
:
false
disable_starttls
:
true
from_address
:
'
test-admin@
localhost
'
from_address
:
'
test-admin@
127.0.0.1
'
username
:
null
password
:
null
...
...
scripts/clean/server/test.sh
View file @
82f33705
...
...
@@ -18,11 +18,11 @@ removeFiles () {
dropRedis
()
{
port
=
$((
9000
+
$1
))
host
=
"
localhost
"
host
=
"
127.0.0.1
"
redis-cli
-h
"
$host
"
KEYS
"bull-
localhost
:
$port
*"
|
grep
-v
empty | xargs
-r
redis-cli
-h
"
$host
"
DEL
redis-cli
-h
"
$host
"
KEYS
"redis-
localhost
:
$port
*"
|
grep
-v
empty | xargs
-r
redis-cli
-h
"
$host
"
DEL
redis-cli
-h
"
$host
"
KEYS
"*redis-
localhost
:
$port
-"
|
grep
-v
empty | xargs
-r
redis-cli
-h
"
$host
"
DEL
redis-cli
-h
"
$host
"
KEYS
"bull-
127.0.0.1
:
$port
*"
|
grep
-v
empty | xargs
-r
redis-cli
-h
"
$host
"
DEL
redis-cli
-h
"
$host
"
KEYS
"redis-
127.0.0.1
:
$port
*"
|
grep
-v
empty | xargs
-r
redis-cli
-h
"
$host
"
DEL
redis-cli
-h
"
$host
"
KEYS
"*redis-
127.0.0.1
:
$port
-"
|
grep
-v
empty | xargs
-r
redis-cli
-h
"
$host
"
DEL
}
seq
=
$(
seq
1 6
)
...
...
server/tests/api/activitypub/client.ts
View file @
82f33705
...
...
@@ -23,7 +23,7 @@ describe('Test activitypub', function () {
const
object
=
res
.
body
expect
(
object
.
type
).
to
.
equal
(
'
Person
'
)
expect
(
object
.
id
).
to
.
equal
(
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/accounts/root
'
)
expect
(
object
.
id
).
to
.
equal
(
servers
[
0
].
url
+
'
/accounts/root
'
)
expect
(
object
.
name
).
to
.
equal
(
'
root
'
)
expect
(
object
.
preferredUsername
).
to
.
equal
(
'
root
'
)
}
...
...
@@ -33,7 +33,7 @@ describe('Test activitypub', function () {
const
object
=
res
.
body
expect
(
object
.
type
).
to
.
equal
(
'
Group
'
)
expect
(
object
.
id
).
to
.
equal
(
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/video-channels/root_channel
'
)
expect
(
object
.
id
).
to
.
equal
(
servers
[
0
].
url
+
'
/video-channels/root_channel
'
)
expect
(
object
.
name
).
to
.
equal
(
'
Main root channel
'
)
expect
(
object
.
preferredUsername
).
to
.
equal
(
'
root_channel
'
)
}
...
...
@@ -43,7 +43,7 @@ describe('Test activitypub', function () {
const
object
=
res
.
body
expect
(
object
.
type
).
to
.
equal
(
'
Video
'
)
expect
(
object
.
id
).
to
.
equal
(
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/videos/watch/
'
+
video
.
uuid
)
expect
(
object
.
id
).
to
.
equal
(
servers
[
0
].
url
+
'
/videos/watch/
'
+
video
.
uuid
)
expect
(
object
.
name
).
to
.
equal
(
'
video
'
)
}
...
...
@@ -52,7 +52,7 @@ describe('Test activitypub', function () {
const
object
=
res
.
body
expect
(
object
.
type
).
to
.
equal
(
'
Playlist
'
)
expect
(
object
.
id
).
to
.
equal
(
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/video-playlists/
'
+
playlist
.
uuid
)
expect
(
object
.
id
).
to
.
equal
(
servers
[
0
].
url
+
'
/video-playlists/
'
+
playlist
.
uuid
)
expect
(
object
.
name
).
to
.
equal
(
'
playlist
'
)
}
...
...
@@ -110,7 +110,7 @@ describe('Test activitypub', function () {
it
(
'
Should redirect to the origin video object
'
,
async
function
()
{
const
res
=
await
makeActivityPubGetRequest
(
servers
[
1
].
url
,
'
/videos/watch/
'
+
video
.
uuid
,
HttpStatusCode
.
FOUND_302
)
expect
(
res
.
header
.
location
).
to
.
equal
(
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/videos/watch/
'
+
video
.
uuid
)
expect
(
res
.
header
.
location
).
to
.
equal
(
servers
[
0
].
url
+
'
/videos/watch/
'
+
video
.
uuid
)
})
it
(
'
Should return the watch action
'
,
async
function
()
{
...
...
server/tests/api/activitypub/fetch.ts
View file @
82f33705
...
...
@@ -35,13 +35,13 @@ describe('Test ActivityPub fetcher', function () {
await
servers
[
0
].
videos
.
upload
({
token
:
userAccessToken
,
attributes
:
{
name
:
'
video user
'
}
})
{
const
to
=
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/accounts/user1
'
const
value
=
'
http://localhost:
'
+
servers
[
1
].
port
+
'
/accounts/user1
'
const
to
=
servers
[
0
].
url
+
'
/accounts/user1
'
const
value
=
servers
[
1
].
url
+
'
/accounts/user1
'
await
servers
[
0
].
sql
.
setActorField
(
to
,
'
url
'
,
value
)
}
{
const
value
=
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/videos/watch/
'
+
uuid
const
value
=
servers
[
2
].
url
+
'
/videos/watch/
'
+
uuid
await
servers
[
0
].
sql
.
setVideoField
(
uuid
,
'
url
'
,
value
)
}
})
...
...
server/tests/api/activitypub/refresher.ts
View file @
82f33705
...
...
@@ -112,16 +112,16 @@ describe('Test AP refresher', function () {
await
wait
(
10000
)
// Change actor name so the remote server returns a 404
const
to
=
'
http://localhost:
'
+
servers
[
1
].
port
+
'
/accounts/user2
'
const
to
=
servers
[
1
].
url
+
'
/accounts/user2
'
await
servers
[
1
].
sql
.
setActorField
(
to
,
'
preferredUsername
'
,
'
toto
'
)
await
command
.
get
({
accountName
:
'
user1@
localhost:
'
+
servers
[
1
].
por
t
})
await
command
.
get
({
accountName
:
'
user2@
localhost:
'
+
servers
[
1
].
por
t
})
await
command
.
get
({
accountName
:
'
user1@
'
+
servers
[
1
].
hos
t
})
await
command
.
get
({
accountName
:
'
user2@
'
+
servers
[
1
].
hos
t
})
await
waitJobs
(
servers
)
await
command
.
get
({
accountName
:
'
user1@
localhost:
'
+
servers
[
1
].
por
t
,
expectedStatus
:
HttpStatusCode
.
OK_200
})
await
command
.
get
({
accountName
:
'
user2@
localhost:
'
+
servers
[
1
].
por
t
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
await
command
.
get
({
accountName
:
'
user1@
'
+
servers
[
1
].
hos
t
,
expectedStatus
:
HttpStatusCode
.
OK_200
})
await
command
.
get
({
accountName
:
'
user2@
'
+
servers
[
1
].
hos
t
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
})
})
...
...
server/tests/api/activitypub/security.ts
View file @
82f33705
...
...
@@ -11,7 +11,7 @@ import { HttpStatusCode } from '@shared/models'
import
{
cleanupTests
,
createMultipleServers
,
killallServers
,
PeerTubeServer
}
from
'
@shared/server-commands
'
function
setKeysOfServer
(
onServer
:
PeerTubeServer
,
ofServer
:
PeerTubeServer
,
publicKey
:
string
,
privateKey
:
string
)
{
const
url
=
'
http://localhost:
'
+
ofServer
.
port
+
'
/accounts/peertube
'
const
url
=
ofServer
.
url
+
'
/accounts/peertube
'
return
Promise
.
all
([
onServer
.
sql
.
setActorField
(
url
,
'
publicKey
'
,
publicKey
),
...
...
@@ -20,7 +20,7 @@ function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, pu
}
function
setUpdatedAtOfServer
(
onServer
:
PeerTubeServer
,
ofServer
:
PeerTubeServer
,
updatedAt
:
string
)
{
const
url
=
'
http://localhost:
'
+
ofServer
.
port
+
'
/accounts/peertube
'
const
url
=
ofServer
.
url
+
'
/accounts/peertube
'
return
Promise
.
all
([
onServer
.
sql
.
setActorField
(
url
,
'
createdAt
'
,
updatedAt
),
...
...
@@ -52,7 +52,7 @@ describe('Test ActivityPub security', function () {
const
baseHttpSignature
=
()
=>
({
algorithm
:
HTTP_SIGNATURE
.
ALGORITHM
,
authorizationHeaderName
:
HTTP_SIGNATURE
.
HEADER_NAME
,
keyId
:
'
acct:peertube@
localhost:
'
+
servers
[
1
].
por
t
,
keyId
:
'
acct:peertube@
'
+
servers
[
1
].
hos
t
,
key
:
keys
.
privateKey
,
headers
:
HTTP_SIGNATURE
.
HEADERS_TO_SIGN
})
...
...
@@ -69,8 +69,8 @@ describe('Test ActivityPub security', function () {
await
setKeysOfServer
(
servers
[
0
],
servers
[
1
],
keys
.
publicKey
,
null
)
await
setKeysOfServer
(
servers
[
1
],
servers
[
1
],
keys
.
publicKey
,
keys
.
privateKey
)
const
to
=
{
url
:
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/accounts/peertube
'
}
const
by
=
{
url
:
'
http://localhost:
'
+
servers
[
1
].
port
+
'
/accounts/peertube
'
,
privateKey
:
keys
.
privateKey
}
const
to
=
{
url
:
servers
[
0
].
url
+
'
/accounts/peertube
'
}
const
by
=
{
url
:
servers
[
1
].
url
+
'
/accounts/peertube
'
,
privateKey
:
keys
.
privateKey
}
await
makeFollowRequest
(
to
,
by
)
})
...
...
@@ -196,8 +196,8 @@ describe('Test ActivityPub security', function () {
await
setKeysOfServer
(
servers
[
1
],
servers
[
1
],
keys
.
publicKey
,
keys
.
privateKey
)
await
setKeysOfServer
(
servers
[
2
],
servers
[
2
],
keys
.
publicKey
,
keys
.
privateKey
)
const
to
=
{
url
:
'
http://localhost:
'
+
servers
[
0
].
port
+
'
/accounts/peertube
'
}
const
by
=
{
url
:
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
,
privateKey
:
keys
.
privateKey
}
const
to
=
{
url
:
servers
[
0
].
url
+
'
/accounts/peertube
'
}
const
by
=
{
url
:
servers
[
2
].
url
+
'
/accounts/peertube
'
,
privateKey
:
keys
.
privateKey
}
await
makeFollowRequest
(
to
,
by
)
})
...
...
@@ -208,9 +208,9 @@ describe('Test ActivityPub security', function () {
await
setKeysOfServer
(
servers
[
2
],
servers
[
2
],
invalidKeys
.
publicKey
,
invalidKeys
.
privateKey
)
const
body
=
getAnnounceWithoutContext
(
servers
[
1
])
body
.
actor
=
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
body
.
actor
=
servers
[
2
].
url
+
'
/accounts/peertube
'
const
signer
:
any
=
{
privateKey
:
invalidKeys
.
privateKey
,
url
:
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
}
const
signer
:
any
=
{
privateKey
:
invalidKeys
.
privateKey
,
url
:
servers
[
2
].
url
+
'
/accounts/peertube
'
}
const
signedBody
=
await
signAndContextify
(
signer
,
body
,
'
Announce
'
)
const
headers
=
buildGlobalHeaders
(
signedBody
)
...
...
@@ -230,12 +230,12 @@ describe('Test ActivityPub security', function () {
await
setKeysOfServer
(
servers
[
0
],
servers
[
2
],
keys
.
publicKey
,
keys
.
privateKey
)
const
body
=
getAnnounceWithoutContext
(
servers
[
1
])
body
.
actor
=
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
body
.
actor
=
servers
[
2
].
url
+
'
/accounts/peertube
'
const
signer
:
any
=
{
privateKey
:
keys
.
privateKey
,
url
:
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
}
const
signer
:
any
=
{
privateKey
:
keys
.
privateKey
,
url
:
servers
[
2
].
url
+
'
/accounts/peertube
'
}
const
signedBody
=
await
signAndContextify
(
signer
,
body
,
'
Announce
'
)
signedBody
.
actor
=
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/account/peertube
'
signedBody
.
actor
=
servers
[
2
].
url
+
'
/account/peertube
'
const
headers
=
buildGlobalHeaders
(
signedBody
)
...
...
@@ -251,9 +251,9 @@ describe('Test ActivityPub security', function () {
this
.
timeout
(
10000
)
const
body
=
getAnnounceWithoutContext
(
servers
[
1
])
body
.
actor
=
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
body
.
actor
=
servers
[
2
].
url
+
'
/accounts/peertube
'
const
signer
:
any
=
{
privateKey
:
keys
.
privateKey
,
url
:
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
}
const
signer
:
any
=
{
privateKey
:
keys
.
privateKey
,
url
:
servers
[
2
].
url
+
'
/accounts/peertube
'
}
const
signedBody
=
await
signAndContextify
(
signer
,
body
,
'
Announce
'
)
const
headers
=
buildGlobalHeaders
(
signedBody
)
...
...
@@ -273,9 +273,9 @@ describe('Test ActivityPub security', function () {
await
setKeysOfServer
(
servers
[
2
],
servers
[
2
],
invalidKeys
.
publicKey
,
invalidKeys
.
privateKey
)
const
body
=
getAnnounceWithoutContext
(
servers
[
1
])
body
.
actor
=
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
body
.
actor
=
servers
[
2
].
url
+
'
/accounts/peertube
'
const
signer
:
any
=
{
privateKey
:
keys
.
privateKey
,
url
:
'
http://localhost:
'
+
servers
[
2
].
port
+
'
/accounts/peertube
'
}
const
signer
:
any
=
{
privateKey
:
keys
.
privateKey
,
url
:
servers
[
2
].
url
+
'
/accounts/peertube
'
}
const
signedBody
=
await
signAndContextify
(
signer
,
body
,
'
Announce
'
)
const
headers
=
buildGlobalHeaders
(
signedBody
)
...
...
server/tests/api/check-params/blocklist.ts
View file @
82f33705
...
...
@@ -163,7 +163,7 @@ describe('Test blocklist API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
host
:
'
localhost
:9002
'
},
fields
:
{
host
:
'
127.0.0.1
:9002
'
},
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
})
...
...
@@ -173,7 +173,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
server
.
accessToken
,
path
,
fields
:
{
host
:
'
localhost
:9003
'
},
fields
:
{
host
:
'
127.0.0.1
:9003
'
},
expectedStatus
:
HttpStatusCode
.
NO_CONTENT_204
})
})
...
...
@@ -183,7 +183,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
server
.
accessToken
,
path
,
fields
:
{
host
:
'
localhost:
'
+
server
.
por
t
},
fields
:
{
host
:
server
.
hos
t
},
expectedStatus
:
HttpStatusCode
.
CONFLICT_409
})
})
...
...
@@ -193,7 +193,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
server
.
accessToken
,
path
,
fields
:
{
host
:
'
localhost:
'
+
servers
[
1
].
por
t
},
fields
:
{
host
:
servers
[
1
].
hos
t
},
expectedStatus
:
HttpStatusCode
.
NO_CONTENT_204
})
})
...
...
@@ -203,7 +203,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should fail with an unauthenticated user
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost:
'
+
servers
[
1
].
por
t
,
path
:
path
+
'
/
'
+
servers
[
1
].
hos
t
,
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
})
...
...
@@ -211,7 +211,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should fail with an unknown server block
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost
:9004
'
,
path
:
path
+
'
/
127.0.0.1
:9004
'
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
...
...
@@ -220,7 +220,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should succeed with the correct params
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost:
'
+
servers
[
1
].
por
t
,
path
:
path
+
'
/
'
+
servers
[
1
].
hos
t
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NO_CONTENT_204
})
...
...
@@ -393,7 +393,7 @@ describe('Test blocklist API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
host
:
'
localhost:
'
+
servers
[
1
].
por
t
},
fields
:
{
host
:
servers
[
1
].
hos
t
},
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
})
...
...
@@ -403,7 +403,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
userAccessToken
,
path
,
fields
:
{
host
:
'
localhost:
'
+
servers
[
1
].
por
t
},
fields
:
{
host
:
servers
[
1
].
hos
t
},
expectedStatus
:
HttpStatusCode
.
FORBIDDEN_403
})
})
...
...
@@ -413,7 +413,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
server
.
accessToken
,
path
,
fields
:
{
host
:
'
localhost
:9003
'
},
fields
:
{
host
:
'
127.0.0.1
:9003
'
},
expectedStatus
:
HttpStatusCode
.
NO_CONTENT_204
})
})
...
...
@@ -423,7 +423,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
server
.
accessToken
,
path
,
fields
:
{
host
:
'
localhost:
'
+
server
.
por
t
},
fields
:
{
host
:
server
.
hos
t
},
expectedStatus
:
HttpStatusCode
.
CONFLICT_409
})
})
...
...
@@ -433,7 +433,7 @@ describe('Test blocklist API validators', function () {
url
:
server
.
url
,
token
:
server
.
accessToken
,
path
,
fields
:
{
host
:
'
localhost:
'
+
servers
[
1
].
por
t
},
fields
:
{
host
:
servers
[
1
].
hos
t
},
expectedStatus
:
HttpStatusCode
.
NO_CONTENT_204
})
})
...
...
@@ -443,7 +443,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should fail with an unauthenticated user
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost:
'
+
servers
[
1
].
por
t
,
path
:
path
+
'
/
'
+
servers
[
1
].
hos
t
,
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
})
...
...
@@ -451,7 +451,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should fail with a user without the appropriate rights
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost:
'
+
servers
[
1
].
por
t
,
path
:
path
+
'
/
'
+
servers
[
1
].
hos
t
,
token
:
userAccessToken
,
expectedStatus
:
HttpStatusCode
.
FORBIDDEN_403
})
...
...
@@ -460,7 +460,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should fail with an unknown server block
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost
:9004
'
,
path
:
path
+
'
/
127.0.0.1
:9004
'
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
...
...
@@ -469,7 +469,7 @@ describe('Test blocklist API validators', function () {
it
(
'
Should succeed with the correct params
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost:
'
+
servers
[
1
].
por
t
,
path
:
path
+
'
/
'
+
servers
[
1
].
hos
t
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NO_CONTENT_204
})
...
...
server/tests/api/check-params/contact-form.ts
View file @
82f33705
...
...
@@ -38,7 +38,7 @@ describe('Test contact form API validators', function () {
await
killallServers
([
server
])
// Contact form is disabled
await
server
.
run
({
smtp
:
{
hostname
:
'
localhost
'
,
port
:
emailPort
},
contact_form
:
{
enabled
:
false
}
})
await
server
.
run
({
smtp
:
{
hostname
:
'
127.0.0.1
'
,
port
:
emailPort
},
contact_form
:
{
enabled
:
false
}
})
await
command
.
send
({
...
defaultBody
,
expectedStatus
:
HttpStatusCode
.
CONFLICT_409
})
})
...
...
@@ -48,7 +48,7 @@ describe('Test contact form API validators', function () {
await
killallServers
([
server
])
// Email & contact form enabled
await
server
.
run
({
smtp
:
{
hostname
:
'
localhost
'
,
port
:
emailPort
}
})
await
server
.
run
({
smtp
:
{
hostname
:
'
127.0.0.1
'
,
port
:
emailPort
}
})
await
command
.
send
({
...
defaultBody
,
fromEmail
:
'
badEmail
'
,
expectedStatus
:
HttpStatusCode
.
BAD_REQUEST_400
})
await
command
.
send
({
...
defaultBody
,
fromEmail
:
'
badEmail@
'
,
expectedStatus
:
HttpStatusCode
.
BAD_REQUEST_400
})
...
...
server/tests/api/check-params/follows.ts
View file @
82f33705
...
...
@@ -48,7 +48,7 @@ describe('Test server follows API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
hosts
:
[
'
localhost:9002
'
,
'
localhost
:coucou
'
]
},
fields
:
{
hosts
:
[
'
127.0.0.1:9002
'
,
'
127.0.0.1
:coucou
'
]
},
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
BAD_REQUEST_400
})
...
...
@@ -58,7 +58,7 @@ describe('Test server follows API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
hosts
:
[
'
localhost
:9002
'
,
'
http://
localhost
:9003
'
]
},
fields
:
{
hosts
:
[
'
127.0.0.1
:9002
'
,
'
http://
127.0.0.1
:9003
'
]
},
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
BAD_REQUEST_400
})
...
...
@@ -68,7 +68,7 @@ describe('Test server follows API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
urls
:
[
'
localhost:9002
'
,
'
localhost
:9002
'
]
},
fields
:
{
urls
:
[
'
127.0.0.1:9002
'
,
'
127.0.0.1
:9002
'
]
},
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
BAD_REQUEST_400
})
...
...
@@ -78,7 +78,7 @@ describe('Test server follows API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
handles
:
[
'
hello@example.com
'
,
'
localhost
:9001
'
]
},
fields
:
{
handles
:
[
'
hello@example.com
'
,
'
127.0.0.1
:9001
'
]
},
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
BAD_REQUEST_400
})
...
...
@@ -98,7 +98,7 @@ describe('Test server follows API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
hosts
:
[
'
localhost
:9002
'
]
},
fields
:
{
hosts
:
[
'
127.0.0.1
:9002
'
]
},
token
:
'
fake_token
'
,
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
...
...
@@ -108,7 +108,7 @@ describe('Test server follows API validators', function () {
await
makePostBodyRequest
({
url
:
server
.
url
,
path
,
fields
:
{
hosts
:
[
'
localhost
:9002
'
]
},
fields
:
{
hosts
:
[
'
127.0.0.1
:9002
'
]
},
token
:
userAccessToken
,
expectedStatus
:
HttpStatusCode
.
FORBIDDEN_403
})
...
...
@@ -217,7 +217,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an invalid token
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9002
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9002
'
,
token
:
'
fake_token
'
,
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
...
...
@@ -226,7 +226,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail if the user is not an administrator
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9002
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9002
'
,
token
:
userAccessToken
,
expectedStatus
:
HttpStatusCode
.
FORBIDDEN_403
})
...
...
@@ -244,7 +244,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an unknown follower
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9003
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9003
'
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
...
...
@@ -257,7 +257,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an invalid token
'
,
async
function
()
{
await
makePostBodyRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9002/accept
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9002/accept
'
,
token
:
'
fake_token
'
,
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
...
...
@@ -266,7 +266,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail if the user is not an administrator
'
,
async
function
()
{
await
makePostBodyRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9002/accept
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9002/accept
'
,
token
:
userAccessToken
,
expectedStatus
:
HttpStatusCode
.
FORBIDDEN_403
})
...
...
@@ -284,7 +284,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an unknown follower
'
,
async
function
()
{
await
makePostBodyRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9003/accept
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9003/accept
'
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
...
...
@@ -297,7 +297,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an invalid token
'
,
async
function
()
{
await
makePostBodyRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9002/reject
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9002/reject
'
,
token
:
'
fake_token
'
,
expectedStatus
:
HttpStatusCode
.
UNAUTHORIZED_401
})
...
...
@@ -306,7 +306,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail if the user is not an administrator
'
,
async
function
()
{
await
makePostBodyRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9002/reject
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9002/reject
'
,
token
:
userAccessToken
,
expectedStatus
:
HttpStatusCode
.
FORBIDDEN_403
})
...
...
@@ -324,7 +324,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an unknown follower
'
,
async
function
()
{
await
makePostBodyRequest
({
url
:
server
.
url
,
path
:
path
+
'
/toto@
localhost
:9003/reject
'
,
path
:
path
+
'
/toto@
127.0.0.1
:9003/reject
'
,
token
:
server
.
accessToken
,
expectedStatus
:
HttpStatusCode
.
NOT_FOUND_404
})
...
...
@@ -337,7 +337,7 @@ describe('Test server follows API validators', function () {
it
(
'
Should fail with an invalid token
'
,
async
function
()
{
await
makeDeleteRequest
({
url
:
server
.
url
,
path
:
path
+
'
/
localhost
:9002
'
,
path
:
path
+
'
/
127.0.0.1
:9002
'
,
token
:
'
fake_token
'
,