forked from External/mage
tests: added additional tests for images download
This commit is contained in:
parent
a81cb306d4
commit
0fc7e1afdc
1 changed files with 47 additions and 0 deletions
|
|
@ -0,0 +1,47 @@
|
||||||
|
package mage.client.game;
|
||||||
|
|
||||||
|
import mage.sets.TheLordOfTheRingsTalesOfMiddleEarth;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.plugins.card.dl.sources.CardImageSource;
|
||||||
|
import org.mage.plugins.card.dl.sources.CardImageUrls;
|
||||||
|
import org.mage.plugins.card.dl.sources.ScryfallImageSource;
|
||||||
|
import org.mage.plugins.card.images.CardDownloadData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public class ScryfallImagesDownloadTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_Cards_DownloadLinks() throws Exception {
|
||||||
|
CardImageSource imageSource = ScryfallImageSource.instance;
|
||||||
|
|
||||||
|
// normal card
|
||||||
|
CardImageUrls urls = imageSource.generateCardUrl(new CardDownloadData("Grizzly Bears", "10E", "268", false, 0));
|
||||||
|
Assert.assertEquals("https://api.scryfall.com/cards/10e/268/en?format=image", urls.baseUrl);
|
||||||
|
|
||||||
|
// various card
|
||||||
|
urls = imageSource.generateCardUrl(new CardDownloadData("Grizzly Bears", "30A", "195", true, 1));
|
||||||
|
Assert.assertEquals("https://api.scryfall.com/cards/30a/195/en?format=image", urls.baseUrl);
|
||||||
|
urls = imageSource.generateCardUrl(new CardDownloadData("Grizzly Bears", "30A", "492", true, 2));
|
||||||
|
Assert.assertEquals("https://api.scryfall.com/cards/30a/492/en?format=image", urls.baseUrl);
|
||||||
|
|
||||||
|
// api link
|
||||||
|
urls = imageSource.generateCardUrl(new CardDownloadData("Ajani, the Greathearted", "WAR", "184*", false, 0));
|
||||||
|
Assert.assertEquals("https://api.scryfall.com/cards/war/184★/en?format=image", urls.baseUrl);
|
||||||
|
|
||||||
|
// direct api link
|
||||||
|
urls = imageSource.generateCardUrl(new CardDownloadData("Command Tower", "REX", "26b", false, 0));
|
||||||
|
Assert.assertEquals("https://api.scryfall.com/cards/rex/26/en?format=image&face=back", urls.baseUrl);
|
||||||
|
|
||||||
|
// the one ring
|
||||||
|
Assert.assertTrue("LTR must use The One Ring with 001 number, not 0", TheLordOfTheRingsTalesOfMiddleEarth.getInstance().getSetCardInfo()
|
||||||
|
.stream()
|
||||||
|
.filter(c -> c.getName().equals("The One Ring"))
|
||||||
|
.anyMatch(c -> c.getCardNumber().equals("001"))
|
||||||
|
);
|
||||||
|
urls = imageSource.generateCardUrl(new CardDownloadData("The One Ring", "LTR", "001", false, 0));
|
||||||
|
Assert.assertEquals("https://api.scryfall.com/cards/ltr/0/en?format=image", urls.baseUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue