rename fixture module name

This commit is contained in:
httprunner
2017-08-29 22:12:08 +08:00
parent 62ffacce20
commit 34d0c6a1e8
10 changed files with 41 additions and 77 deletions
+3 -3
View File
@@ -38,7 +38,7 @@ To ensure the installation or upgrade is successful, you can execute command `at
```text ```text
$ ate -V $ ate -V
ApiTestEngine version: 0.5.1 ApiTestEngine version: 0.5.4
``` ```
Execute the command `ate -h` to view command help. Execute the command `ate -h` to view command help.
@@ -74,7 +74,7 @@ To install mail helper, run this command in your terminal:
$ pip install -U git+https://github.com/debugtalk/jenkins-mail-py.git#egg=jenkins-mail-py $ pip install -U git+https://github.com/debugtalk/jenkins-mail-py.git#egg=jenkins-mail-py
$ ate -V $ ate -V
jenkins-mail-py version: 0.2.5 jenkins-mail-py version: 0.2.5
ApiTestEngine version: 0.5.1 ApiTestEngine version: 0.5.4
``` ```
With [`jenkins-mail-py`][jenkins-mail-py] installed, you can see more optional arguments. With [`jenkins-mail-py`][jenkins-mail-py] installed, you can see more optional arguments.
@@ -133,7 +133,7 @@ And here is testset example of typical scenario: get token at the beginning, and
- config: - config:
name: "create user testsets." name: "create user testsets."
import_module_functions: import_module_functions:
- tests.data.custom_functions - tests.data.debugtalk
variable_binds: variable_binds:
- user_agent: 'iOS/10.3' - user_agent: 'iOS/10.3'
- device_sn: ${gen_random_string(15)} - device_sn: ${gen_random_string(15)}
+1 -1
View File
@@ -25,7 +25,7 @@ class Runner(object):
"lambda *str_args: hashlib.md5(''.join(str_args).\ "lambda *str_args: hashlib.md5(''.join(str_args).\
encode('utf-8')).hexdigest()" encode('utf-8')).hexdigest()"
}, },
"import_module_functions": ["test.data.custom_functions"], "import_module_functions": ["test.data.debugtalk"],
"variable_binds": [ "variable_binds": [
{"TOKEN": "debugtalk"}, {"TOKEN": "debugtalk"},
{"random": "${gen_random_string(5)}"}, {"random": "${gen_random_string(5)}"},
+1 -1
View File
@@ -1,7 +1,7 @@
- test: - test:
name: get token name: get token
import_module_functions: import_module_functions:
- examples.utils - examples.debugtalk
variable_binds: variable_binds:
- user_agent: 'iOS/10.3' - user_agent: 'iOS/10.3'
- device_sn: ${gen_random_string(15)} - device_sn: ${gen_random_string(15)}
+1 -1
View File
@@ -1,7 +1,7 @@
- config: - config:
name: "smoketest for CRUD users." name: "smoketest for CRUD users."
import_module_functions: import_module_functions:
- examples.utils - examples.debugtalk
variable_binds: variable_binds:
- device_sn: ${gen_random_string(15)} - device_sn: ${gen_random_string(15)}
request: request:
-67
View File
@@ -1,67 +0,0 @@
import hashlib
import hmac
import json
import random
import string
import time
try:
string_type = basestring
PYTHON_VERSION = 2
import urllib
except NameError:
string_type = str
PYTHON_VERSION = 3
import urllib.parse as urllib
SECRET_KEY = "DebugTalk"
def gen_random_string(str_len):
random_char_list = []
for _ in range(str_len):
random_char = random.choice(string.ascii_letters + string.digits)
random_char_list.append(random_char)
random_string = ''.join(random_char_list)
return random_string
gen_random_string_lambda = lambda str_len: ''.join(
random.choice(string.ascii_letters + string.digits) for _ in range(str_len))
def get_sign(*args):
content = ''.join(args).encode('ascii')
sign_key = SECRET_KEY.encode('ascii')
sign = hmac.new(sign_key, content, hashlib.sha1).hexdigest()
return sign
get_sign_lambda = lambda *args: hmac.new(
'DebugTalk'.encode('ascii'),
''.join(args).encode('ascii'),
hashlib.sha1).hexdigest()
def gen_md5(*args):
return hashlib.md5("".join(args).encode('utf-8')).hexdigest()
def gen_urlencode_str(**kargs):
urlencoded_str = ""
quote_times = int(kargs.pop("quote_times", 1))
for key, value in kargs.items():
urlencoded_str += key
urlencoded_str += "="
if value == "undefined":
urlencoded_str += "undefined"
else:
if isinstance(value, (dict, list)):
value = json.dumps(value)
elif isinstance(value, (int, float)):
value = str(value)
value_str = value.encode('utf-8')
for _ in range(quote_times):
value_str = urllib.quote_plus(value_str)
urlencoded_str += value_str
urlencoded_str += "&"
return urlencoded_str.strip("&")
+31
View File
@@ -0,0 +1,31 @@
import hashlib
import hmac
import json
import random
import string
import time
try:
string_type = basestring
PYTHON_VERSION = 2
import urllib
except NameError:
string_type = str
PYTHON_VERSION = 3
import urllib.parse as urllib
SECRET_KEY = "DebugTalk"
def get_sign(*args):
content = ''.join(args).encode('ascii')
sign_key = SECRET_KEY.encode('ascii')
sign = hmac.new(sign_key, content, hashlib.sha1).hexdigest()
return sign
get_sign_lambda = lambda *args: hmac.new(
'DebugTalk'.encode('ascii'),
''.join(args).encode('ascii'),
hashlib.sha1).hexdigest()
def gen_md5(*args):
return hashlib.md5("".join(args).encode('utf-8')).hexdigest()
+1 -1
View File
@@ -28,7 +28,7 @@ bind_lambda_functions_with_import:
bind_module_functions: bind_module_functions:
function_binds: function_binds:
import_module_functions: import_module_functions:
- tests.data.custom_functions - tests.data.debugtalk
variable_binds: variable_binds:
- TOKEN: debugtalk - TOKEN: debugtalk
- random: ${gen_random_string(5)} - random: ${gen_random_string(5)}
@@ -1,7 +1,7 @@
- config: - config:
name: "create user testsets." name: "create user testsets."
import_module_functions: import_module_functions:
- tests.data.custom_functions - tests.data.debugtalk
variable_binds: variable_binds:
- user_agent: 'iOS/10.3' - user_agent: 'iOS/10.3'
- device_sn: ${gen_random_string(15)} - device_sn: ${gen_random_string(15)}
+2 -2
View File
@@ -142,7 +142,7 @@ class VariableBindsUnittest(unittest.TestCase):
def test_import_module_functions(self): def test_import_module_functions(self):
testcase1 = { testcase1 = {
"import_module_functions": ["tests.data.custom_functions"], "import_module_functions": ["tests.data.debugtalk"],
"variable_binds": [ "variable_binds": [
{"TOKEN": "debugtalk"}, {"TOKEN": "debugtalk"},
{"random": "${gen_random_string(5)}"}, {"random": "${gen_random_string(5)}"},
@@ -199,7 +199,7 @@ class VariableBindsUnittest(unittest.TestCase):
def test_get_parsed_request(self): def test_get_parsed_request(self):
test_runner = runner.Runner() test_runner = runner.Runner()
testcase = { testcase = {
"import_module_functions": ["tests.data.custom_functions"], "import_module_functions": ["tests.data.debugtalk"],
"variable_binds": [ "variable_binds": [
{"TOKEN": "debugtalk"}, {"TOKEN": "debugtalk"},
{"random": "${gen_random_string(5)}"}, {"random": "${gen_random_string(5)}"},