Skip to content

Commit

Permalink
Add test for downgrading huffman balance
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkarakostas committed Dec 15, 2017
1 parent 4e39d15 commit a515702
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions backend/breach/tests/test_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a515702

Please # to comment.