diff --git a/backend/breach/tests/test_strategy.py b/backend/breach/tests/test_strategy.py index 33046bc6..1171fda3 100644 --- a/backend/breach/tests/test_strategy.py +++ b/backend/breach/tests/test_strategy.py @@ -217,6 +217,29 @@ def test_divide_and_conquer(self, Sniffer): ) strategy1._mark_current_work_completed() + @patch('breach.strategy.Sniffer') + def test_downgrade_huffman_balance(self, Sniffer): + target = Target.objects.create( + name='maxreflection', + endpoint='https://test.com/?breach=%s', + prefix='test', + alphabet='0123', + maxreflectionlength=30, + method=2 + ) + + victim = Victim.objects.create( + target=target, + sourceip='192.168.10.141', + snifferendpoint='http://localhost/' + ) + + strategy = Strategy(victim) + work = strategy.get_work() + self.assertEqual(work, {'url': u'https://test.com/?breach=^3^2^test1^test0^', 'amount': 64, 'timeout': 0, 'alignmentalphabet': u''}) + + target.delete() + @patch('breach.strategy.Sniffer') def test_downgrade_to_serial(self, Sniffer): target = Target.objects.create(