Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add additional integration tests
  • Loading branch information
andreashappe committed Jun 14, 2024
commit b14f5fb9d6b45b4e36578c1a90b89e81545d43df
46 changes: 45 additions & 1 deletion tests/integration_minimal_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

from typing import Tuple
from hackingBuddyGPT.usecases.minimal.agent import MinimalLinuxPrivesc
from hackingBuddyGPT.usecases.minimal.agent_with_state import MinimalLinuxTemplatedPrivesc
from hackingBuddyGPT.usecases.privesc.linux import LinuxPrivesc
from hackingBuddyGPT.utils.console.console import Console
from hackingBuddyGPT.utils.db_storage.db_storage import DbStorage
Expand Down Expand Up @@ -63,7 +65,7 @@ def get_response(self, prompt, *, capabilities=None, **kwargs) -> LLMResult:
def encode(self, query) -> list[int]:
return [0]

def test_minimal_linuxprives():
def test_linuxprivesc():

conn = FakeSSHConnection()
llm = FakeLLM()
Expand All @@ -85,7 +87,49 @@ def test_minimal_linuxprives():
)

priv_esc.init()
result = priv_esc.run()
assert result is True

def test_minimal_agent():

conn = FakeSSHConnection()
llm = FakeLLM()
log_db = DbStorage(':memory:')
console = Console()

log_db.init()

priv_esc = MinimalLinuxPrivesc(
conn=conn,
log_db = log_db,
console = console,
llm = llm,
tag = 'integration_test_linuxprivesc',
max_turns = len(llm.responses)
)

priv_esc.init()
result = priv_esc.run()
assert result is True

def test_minimal_agent_state():

conn = FakeSSHConnection()
llm = FakeLLM()
log_db = DbStorage(':memory:')
console = Console()

log_db.init()

priv_esc = MinimalLinuxTemplatedPrivesc(
conn=conn,
log_db = log_db,
console = console,
llm = llm,
tag = 'integration_test_linuxprivesc',
max_turns = len(llm.responses)
)

priv_esc.init()
result = priv_esc.run()
assert result is True