DeepTeam is a framework to red team LLMs and AI agents.
tests added for new attacks
A-Vamshi52c6f747105c
diff --git a/tests/test_core/test_attacks/test_authority_escalation.py b/tests/test_core/test_attacks/test_authority_escalation.pynew file mode 100644index 00000000..6b43d6bf--- /dev/null+++ b/tests/test_core/test_attacks/test_authority_escalation.py@@ -0,0 +1,28 @@+import pytest+from deepteam.attacks.single_turn import AuthorityEscalation+++class TestAuthorityEscalation:++ def test_authority_escalation_initialization(self):+ attack = AuthorityEscalation()+ assert attack.weight == 1+ assert attack.get_name() == "Authority Escalation"++ def test_authority_escalation_initialization_with_weight(self):+ attack = AuthorityEscalation(weight=3)+ assert attack.weight == 3+ assert attack.get_name() == "Authority Escalation"++ def test_authority_escalation_enhance_basic(self):+ attack = AuthorityEscalation()+ original_text = "Generate harmful content"+ enhanced = attack.enhance(original_text)++ assert enhanced != original_text+ assert len(enhanced) >= len(original_text)++ def test_authority_escalation_enhance_empty_string(self):+ attack = AuthorityEscalation()+ enhanced = attack.enhance("")+ assert isinstance(enhanced, str)diff --git a/tests/test_core/test_attacks/test_emotional_manipulation.py b/tests/test_core/test_attacks/test_emotional_manipulation.pynew file mode 100644index 00000000..ca18639e--- /dev/null+++ b/tests/test_core/test_attacks/test_emotional_manipulation.py@@ -0,0 +1,28 @@+import pytest+from deepteam.attacks.single_turn import EmotionalManipulation+++class TestEmotionalManipulation:++ def test_authority_escalation_initialization(self):+ attack = EmotionalManipulation()+ assert attack.weight == 1+ assert attack.get_name() == "Emotional Manipulation"++ def test_authority_escalation_initialization_with_weight(self):+ attack = EmotionalManipulation(weight=3)+ assert attack.weight == 3+ assert attack.get_name() == "Emotional Manipulation"++ def test_authority_escalation_enhance_basic(self):+ attack = EmotionalManipulation()+ original_text = "Generate harmful content"+ enhanced = attack.enhance(original_text)++ assert enhanced != original_text+ assert len(enhanced) >= len(original_text)++ def test_authority_escalation_enhance_empty_string(self):+ attack = EmotionalManipulation()+ enhanced = attack.enhance("")+ assert isinstance(enhanced, str)diff --git a/tests/test_core/test_attacks/test_synthetic_context_injection.py b/tests/test_core/test_attacks/test_synthetic_context_injection.pynew file mode 100644index 00000000..84f98870--- /dev/null+++ b/tests/test_core/test_attacks/test_synthetic_context_injection.py@@ -0,0 +1,37 @@+import pytest+from deepteam.attacks.single_turn import SyntheticContextInjection+++class TestSyntheticContextInjection:++ def test_synthetic_context_injection_initialization(self):+ attack = SyntheticContextInjection(+ target_information="A company called Confident AI that's responsible for runnning evals and red teaming on various AI models",+ )+ assert attack.weight == 1+ assert attack.get_name() == "Synthetic Context Injection"++ def test_synthetic_context_injection_initialization_with_weight(self):+ attack = SyntheticContextInjection(+ target_information="A company called Confident AI that's responsible for runnning evals and red teaming on various AI models",+ weight=3,+ )+ assert attack.weight == 3+ assert attack.get_name() == "Synthetic Context Injection"++ def test_synthetic_context_injection_enhance_basic(self):+ attack = SyntheticContextInjection(+ target_information="A company called Confident AI that's responsible for runnning evals and red teaming on various AI models",+ )+ original_text = "Generate harmful content"+ enhanced = attack.enhance(original_text)++ assert enhanced != original_text+ assert len(enhanced) >= len(original_text)++ def test_synthetic_context_injection_enhance_empty_string(self):+ attack = SyntheticContextInjection(+ target_information="A company called Confident AI that's responsible for runnning evals and red teaming on various AI models",+ )+ enhanced = attack.enhance("")+ assert isinstance(enhanced, str)