Skip to content

Commit

Permalink
update all python tests
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Queinnec <[email protected]>
  • Loading branch information
hugoqnc committed Sep 19, 2024
1 parent e5af1dc commit d8e6bed
Show file tree
Hide file tree
Showing 43 changed files with 132 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaAESGCMTest extends TestBase {
class PycaAESGCMTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/aead/PycaAESGCMTestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,19 @@
import com.ibm.mapper.model.functionality.Encrypt;
import com.ibm.mapper.model.functionality.KeyGeneration;
import com.ibm.plugin.TestBase;
import com.ibm.plugin.utils.GenerateAssertsHelper;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaChaCha20Poly1305Test extends TestBase {
class PycaChaCha20Poly1305Test extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/aead/PycaChaCha20Poly1305TestFile.py", this);
}
Expand Down Expand Up @@ -83,8 +82,6 @@ public void asserts(
assertThat(encryptValue).isInstanceOf(CipherAction.class);
assertThat(encryptValue.asString()).isEqualTo("DECRYPT");

GenerateAssertsHelper.generate(detectionStore, nodes);

/*
* Translation
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaDSANumbersTest extends TestBase {
class PycaDSANumbersTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/DSA/PycaDSANumbersTestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaDSASignTest extends TestBase {
class PycaDSASignTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/DSA/PycaDSASignTestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
Expand All @@ -45,7 +45,7 @@ public final class PycaDiffieHellmanGenerateTest extends TestBase {
// The key size does not yet appear because
// of the TraceSymbol problem documented on the Github issue
@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/DiffieHellman/PycaDiffieHellmanGenerateTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaDiffieHellmanNumbersTest extends TestBase {
class PycaDiffieHellmanNumbersTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/DiffieHellman/PycaDiffieHellmanNumbersTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaEllipticCurveDeriveTest extends TestBase {
class PycaEllipticCurveDeriveTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveDeriveTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaEllipticCurveKeyExchangeTest extends TestBase {
class PycaEllipticCurveKeyExchangeTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveKeyExchangeTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaEllipticCurveNumbersTest extends TestBase {
class PycaEllipticCurveNumbersTest extends TestBase {

@Ignore("In this testcase the name of a var is resolved, but not teh actual value.")
@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveNumbersTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaEllipticCurveSign2Test extends TestBase {
class PycaEllipticCurveSign2Test extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveSign2TestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaEllipticCurveSignTest extends TestBase {
class PycaEllipticCurveSignTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveSignTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaEllipticCurveVerifyTest extends TestBase {
class PycaEllipticCurveVerifyTest extends TestBase {

// junit4
@Ignore(
@Disabled(
"Reenable once we have an approach to detect `verify` (either make it an entry\n"
+ "point, or better handle file imports for depending detection rule)")
@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/EllipticCurve/PycaEllipticCurveVerifyTestFile.py",
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaRSADecryptTest extends TestBase {
class PycaRSADecryptTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/RSA/PycaRSADecryptTestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaRSANumbersTest extends TestBase {
class PycaRSANumbersTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/RSA/PycaRSANumbersTestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaRSASign1Test extends TestBase {
class PycaRSASign1Test extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/RSA/PycaRSASign1TestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaRSASign2Test extends TestBase {
class PycaRSASign2Test extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/asymmetric/RSA/PycaRSASign2TestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaFernetDecryptTest extends TestBase {
class PycaFernetDecryptTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/fernet/PycaFernetDecryptTestFile.py", this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
import com.ibm.plugin.TestBase;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.sonar.plugins.python.api.PythonCheck;
import org.sonar.plugins.python.api.PythonVisitorContext;
import org.sonar.plugins.python.api.symbols.Symbol;
import org.sonar.plugins.python.api.tree.Tree;
import org.sonar.python.checks.utils.PythonCheckVerifier;

public class PycaFernetEncryptTest extends TestBase {
class PycaFernetEncryptTest extends TestBase {

@Test
public void test() {
void test() {
PythonCheckVerifier.verify(
"src/test/files/rules/detection/fernet/PycaFernetEncryptTestFile.py", this);
}
Expand Down
Loading

0 comments on commit d8e6bed

Please sign in to comment.