mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add tests for playlist.
This commit is contained in:
parent
b049848e79
commit
797a621b51
3 changed files with 21 additions and 3 deletions
|
@ -965,9 +965,12 @@ public class ResponseHelper {
|
||||||
s.save(playlist);
|
s.save(playlist);
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
}
|
|
||||||
|
|
||||||
return Constants.mapper.writeValueAsBytes(new AcceptedResponse());
|
ObjectNode response = Constants.mapper.createObjectNode();
|
||||||
|
response.put("playlistId", String.valueOf(playlist.getPlaylistId()));
|
||||||
|
|
||||||
|
return Constants.mapper.writeValueAsBytes(response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] playlistsResponse(String session) throws IOException {
|
public static byte[] playlistsResponse(String session) throws IOException {
|
||||||
|
|
|
@ -38,7 +38,8 @@ public class Playlist {
|
||||||
@Column(name = "thumbnail", length = 300)
|
@Column(name = "thumbnail", length = 300)
|
||||||
private String thumbnail;
|
private String thumbnail;
|
||||||
|
|
||||||
@Column(name = "owner", nullable = false)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "owner")
|
||||||
private User owner;
|
private User owner;
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.LAZY)
|
@ElementCollection(fetch = FetchType.LAZY)
|
||||||
|
|
|
@ -84,3 +84,17 @@ sleep 2
|
||||||
|
|
||||||
# Check Feed
|
# Check Feed
|
||||||
curl ${CURLOPTS[@]} $HOST/feed -G --data-urlencode "authToken=$AUTH_TOKEN" || exit 1
|
curl ${CURLOPTS[@]} $HOST/feed -G --data-urlencode "authToken=$AUTH_TOKEN" || exit 1
|
||||||
|
|
||||||
|
PLAYLIST_NAME=$(openssl rand -hex 6)
|
||||||
|
|
||||||
|
# Create a Playlist
|
||||||
|
curl ${CURLOPTS[@]} $HOST/user/playlists/create -X POST -H "Content-Type: application/json" -H "Authorization: $AUTH_TOKEN" -d $(jq -n --compact-output --arg name "$PLAYLIST_NAME" '{"name": $name}') || exit 1
|
||||||
|
|
||||||
|
# See created playlists
|
||||||
|
curl ${CURLOPTS[@]} $HOST/user/playlists -H "Authorization: $AUTH_TOKEN" || exit 1
|
||||||
|
|
||||||
|
# Get Playlist ID
|
||||||
|
PLAYLIST_ID=$(curl -s -o - -f $HOST/user/playlists -H "Authorization: $AUTH_TOKEN" | jq -r ".[0].id") || exit 1
|
||||||
|
|
||||||
|
# Playlist Test
|
||||||
|
curl ${CURLOPTS[@]} $HOST/playlists/$PLAYLIST_ID || exit 1
|
||||||
|
|
Loading…
Reference in a new issue