- Add -s/-u/-p/-d/-h command line options - Add maven-shade-plugin for fat jar packaging - Fix proxyImport signature to accept proxyHost parameter Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
37 lines
1.2 KiB
Java
37 lines
1.2 KiB
Java
package com.ets.scraper;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.io.TempDir;
|
|
|
|
import java.io.File;
|
|
import java.nio.file.Path;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class ImportTest {
|
|
|
|
private static final String PROXY_HOST = "https://api.ets.niko.red";
|
|
private static final String USERNAME = "admin";
|
|
private static final String PASSWORD = "123456";
|
|
|
|
@TempDir
|
|
Path tempDir;
|
|
|
|
@Test
|
|
void testImportExcel() throws Exception {
|
|
File testFile = tempDir.resolve("三联单列表_20260504.xls").toFile();
|
|
Path source = Path.of("downloads/三联单列表_20260504.xls");
|
|
if (source.toFile().exists()) {
|
|
java.nio.file.Files.copy(source, testFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
|
|
} else {
|
|
System.out.println("[!] Test file not found at " + source + ", using temp file as fallback");
|
|
}
|
|
assertTrue(testFile.exists(), "Test file must exist");
|
|
|
|
String token = EtsScraper.proxyLogin(PROXY_HOST, USERNAME, PASSWORD);
|
|
assertNotNull(token);
|
|
|
|
EtsScraper.proxyImport(testFile.toPath(), PROXY_HOST, token);
|
|
}
|
|
}
|