Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
3b36b636
Commit
3b36b636
authored
8 years ago
by
gpotter2
Committed by
gpotter2
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix mock_windows tests
parent
ecda1d9e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
appveyor.yml
+1
-1
1 addition, 1 deletion
appveyor.yml
test/mock_windows.uts
+2
-21
2 additions, 21 deletions
test/mock_windows.uts
with
3 additions
and
22 deletions
appveyor.yml
+
1
−
1
View file @
3b36b636
...
@@ -15,7 +15,7 @@ install:
...
@@ -15,7 +15,7 @@ install:
-
choco install -y npcap wireshark
-
choco install -y npcap wireshark
-
ps
:
.\.appveyor\InstallWindump.ps1
-
ps
:
.\.appveyor\InstallWindump.ps1
# Install Python modules
# Install Python modules
-
"
%PYTHON%
\\
python
-m
pip
install
cryptography
coverage
mock
pyreadline
keyboard
"
-
"
%PYTHON%
\\
python
-m
pip
install
cryptography
coverage
mock
pyreadline"
-
set PATH="%PYTHON%\\Scripts\\;%PATH%"
-
set PATH="%PYTHON%\\Scripts\\;%PATH%"
test_script
:
test_script
:
...
...
This diff is collapsed.
Click to expand it.
test/mock_windows.uts
+
2
−
21
View file @
3b36b636
...
@@ -82,21 +82,6 @@ import sys
...
@@ -82,21 +82,6 @@ import sys
import mock
import mock
import readline
import readline
from threading import Thread, Event
class sendTextAndTab(Thread):
"""Send text directly as Input"""
def __init__(self, event, text):
Thread.__init__(self)
self.stopped = event
self.send_text = text
def run(self):
import keyboard
time.sleep(1)
while not self.stopped.wait(0.5):
keyboard.write(self.send_text)
keyboard.send("tab")
keyboard.send("enter")
index = 0
index = 0
@mock.patch("pyreadline.console.console.Console.size")
@mock.patch("pyreadline.console.console.Console.size")
...
@@ -114,12 +99,8 @@ def emulate_main_input(data, mock_readfunc, mock_pyr_size):
...
@@ -114,12 +99,8 @@ def emulate_main_input(data, mock_readfunc, mock_pyr_size):
r_data = data[index]
r_data = data[index]
if r_data.startswith("#AUTOCOMPLETE"):
if r_data.startswith("#AUTOCOMPLETE"):
send_text = re.match(r'#AUTOCOMPLETE{(.*)}', r_data).group(1)
send_text = re.match(r'#AUTOCOMPLETE{(.*)}', r_data).group(1)
stopFlag = Event()
cmpl = readline.rl.get_completer()
thread = sendTextAndTab(stopFlag, send_text)
r_data = cmpl(send_text, 0)
thread.start()
# This will block the program until the thread has pushed the stuff
r_data = readline.rl.readline()
stopFlag.set()
index +=1
index +=1
print r_data
print r_data
return r_data
return r_data
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment