-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
145 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
recursive-include bombard/examples *.py *.yaml | ||
include bombard/LICENSE.txt | ||
global-exclude __init__.py | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
__version__ = '1.8.1' | ||
__version__ = '1.9.1' | ||
|
||
|
||
def version(): | ||
""" 'major.minor' without build number """ | ||
return '.'.join(__version__.split('.')[:2]) | ||
|
||
|
||
if __name__ == '__main__': | ||
print(version()) | ||
print(version()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[metadata] | ||
# This includes the license file(s) in the wheel. | ||
# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file | ||
license_files = LICENSE.txt | ||
license_files = bombard/LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import json | ||
|
||
|
||
FAKE_RESP = { | ||
('GET', '/posts'): [ | ||
{'id': 1}, {'id': 2}, {'id': 3} | ||
], | ||
('GET', '/posts/1'): '', | ||
('GET', '/posts/2'): '', | ||
('GET', '/posts/3'): '', | ||
} | ||
|
||
|
||
class FakeResp: | ||
status = 200 | ||
body = None | ||
|
||
def __init__(self, resp_body): | ||
self.body = resp_body | ||
|
||
def read(self): | ||
return self.body | ||
|
||
|
||
class FakeJSONPlaceholder: | ||
def request(self, method, path, body=None, headers=None): | ||
self.method = method | ||
self.path = path | ||
|
||
def response(self): | ||
return FakeResp(json.dumps( | ||
FAKE_RESP[(self.method, self.path)] | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import unittest | ||
from bombard import http_request | ||
from bombard.request_logging import setup_logging | ||
import logging | ||
from tests.stdout_capture import CaptureOutput | ||
from tests.fake_args import FakeArgs | ||
from bombard.main import campaign | ||
from tests.fake_jsonplaceholder import FakeJSONPlaceholder | ||
|
||
|
||
class TestExamples(unittest.TestCase): | ||
def setUp(self): | ||
self.fake_server = FakeJSONPlaceholder() | ||
http_request.http.client.HTTPSConnection.request = self.fake_server.request | ||
http_request.http.client.HTTPSConnection.getresponse = self.fake_server.response | ||
setup_logging(logging.DEBUG) | ||
|
||
def testSimplest(self): | ||
with CaptureOutput(capture=True) as captured: | ||
campaign(FakeArgs(example='simplest')) | ||
self.assertIn( | ||
'GET jsonplaceholder.typicode.com/posts', | ||
captured.output | ||
) | ||
self.assertIn( | ||
'GET jsonplaceholder.typicode.com/posts/1', | ||
captured.output | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from tests.stdout_capture import CaptureOutput | ||
import unittest | ||
from bombard.main import campaign | ||
from tests.fake_args import FakeArgs | ||
import bombard | ||
|
||
|
||
class TestVersion(unittest.TestCase): | ||
def testVersion(self): | ||
with CaptureOutput() as captured: | ||
campaign(FakeArgs(version=True)) | ||
|
||
with open(f'bombard/LICENSE.txt') as license: | ||
self.assertIn( | ||
license.readline(), | ||
captured.output | ||
) | ||
self.assertIn( | ||
bombard.version(), | ||
captured.output | ||
) |