AutoHotKey 1st version.

anticaptcha
Pedro de Oliveira Guedes 2022-01-11 11:57:48 -03:00
parent 6500927d33
commit 9832e1ddc6
3 changed files with 68 additions and 0 deletions

View File

@ -42,3 +42,33 @@ class AutoHotKey:
else:
return res.text
def test (self):
"""
## AutoHotKey Test
Este método é utilizado para testar se o AutoHotKey está corretamente instalado na máquina do usuário, além de garantir que o serviço do mesmo também está instalado e funcionando corretamente.
---
#### Parâmetros:
---
---
#### Retorna:
-> "AHK Svc Ok" caso tudo esteja funcionando corretamente.
"""
return self.__request_raw_post__ ("/ipc/ahk/test")
def do (self, command: str):
"""
## AutoHotKey Do
Realiza algum comando AutoHotKey passado como parâmetro.
---
#### Parâmetros:
- command: Comando AutoHotKey que se deseja executar
---
#### Retorna:
-> O retorno do comando, se houver.
"""
return self.__request_raw_post__ ("/ipc/ahk/do", command)

View File

@ -0,0 +1,12 @@
Feature: The AutoHotKey API client
# ======================== AutoHotKey Test ========================
Scenario: Testing the AutoHotKey client
Given the AutoHotKey client
When the test method is called
Then the string "AHK Svc Ok" must be returned
# ======================== AutoHotKey Test ========================
Scenario: Using an AutoHotKey command through AutoHotKey client
Given the AutoHotKey client
When the do method is called
Then if there is a return in AHK, it must appear

View File

@ -0,0 +1,26 @@
from behave import *
from cli import AutoHotKey
# ================================== AutoHotKey Test ==================================
@given(u'the AutoHotKey client')
def step_impl(context):
context.client = AutoHotKey ()
@when(u'the test method is called')
def step_impl(context):
context.test_return = context.client.test ()
@then(u'the string "AHK Svc Ok" must be returned')
def step_impl(context):
assert context.test_return == "AHK Svc Ok", "There is something wrong with te AHK or it's service."
# ================================== AutoHotKey Do ==================================
@when(u'the do method is called')
def step_impl(context):
context.do_return = context.client.do ('clipboard := "Riptide"')
@then(u'if there is a return in AHK, it must appear')
def step_impl(context):
assert context.do_return == "", "Something went wrong with the command given."