-
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.
Merge pull request #7 from shanejansen/develop
Develop
- Loading branch information
Showing
32 changed files
with
506 additions
and
60 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install . | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,42 @@ | ||
S3 | ||
====== | ||
Used to mock a S3 object storage dependency. | ||
|
||
|
||
## Specs | ||
* Name: s3 | ||
* Dev Port: 9000 | ||
* Username: admin123 | ||
* Password: admin123 | ||
|
||
|
||
## Configuration | ||
N/A | ||
|
||
|
||
## Defaults Example | ||
```yaml | ||
--- | ||
buckets: | ||
- name: mybucket | ||
objects: | ||
- name: foo.csv | ||
content-type: text/csv | ||
path: ./s3-objects/foo.csv | ||
- name: test/bar.png | ||
content-type: image/png | ||
path: ./s3-objects/bar.png | ||
``` | ||
|
||
|
||
## Usage Example | ||
```python | ||
# Create a bucket | ||
self.mocks.s3.setup.create_bucket('bucket_name') | ||
|
||
# Put an object in a bucket | ||
self.mocks.s3.setup.put_object('bucket_name', 'object_name', data) | ||
|
||
# Verify an object exists in a bucket | ||
result: bool = self.mocks.s3.verify.object_exists('bucket_name', 'object_name') | ||
``` |
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,99 @@ | ||
import unittest | ||
from unittest import TestCase, mock | ||
|
||
from touchstone import common | ||
|
||
|
||
class TestCommon(TestCase): | ||
@mock.patch('touchstone.common.os') | ||
def test_sanityCheckPasses_requirementsMet_ReturnsTrue(self, mock_os): | ||
# Given | ||
mock_os.getcwd.return_value = 'temp' | ||
mock_os.path.exists.return_value = True | ||
|
||
# When | ||
result = common.sanity_check_passes() | ||
|
||
# Then | ||
self.assertTrue(result) | ||
|
||
@mock.patch('touchstone.common.os') | ||
def test_sanityCheckPasses_requirementsNotMet_ReturnsFalse(self, mock_os): | ||
# Given | ||
mock_os.getcwd.return_value = 'temp' | ||
mock_os.path.exists.return_value = False | ||
|
||
# When | ||
result = common.sanity_check_passes() | ||
|
||
# Then | ||
self.assertFalse(result) | ||
|
||
def test_dictMerge_emptyOverride_ReturnsBase(self): | ||
# Given | ||
base = {'foo': 'bar'} | ||
override = {} | ||
|
||
# When | ||
result = common.dict_merge(base, override) | ||
|
||
# Then | ||
self.assertDictEqual(result, base) | ||
|
||
def test_dictMerge_noOverlap_ReturnsCombined(self): | ||
# Given | ||
base = {'foo': 'bar'} | ||
override = {'bar': 'foo'} | ||
|
||
# When | ||
result = common.dict_merge(base, override) | ||
|
||
# Then | ||
expected = {'foo': 'bar', 'bar': 'foo'} | ||
self.assertDictEqual(result, expected) | ||
|
||
def test_dictMerge_withOverlap_OverrideTakesPrecedence(self): | ||
# Given | ||
base = {'foo': 'bar', 'bar': 'foo'} | ||
override = {'bar': 'buzz'} | ||
|
||
# When | ||
result = common.dict_merge(base, override) | ||
|
||
# Then | ||
expoected = {'foo': 'bar', 'bar': 'buzz'} | ||
self.assertDictEqual(result, expoected) | ||
|
||
def test_toSnake_string_ReturnsSnake(self): | ||
# Given | ||
input = 'fooBar' | ||
|
||
# When | ||
result = common.to_snake(input) | ||
|
||
# Then | ||
self.assertEqual(result, 'foo_bar') | ||
|
||
def test_toSnake_dict_ReturnsSnakeKeys(self): | ||
# Given | ||
input = {'fooKey': 'barValue'} | ||
|
||
# When | ||
result = common.to_snake(input) | ||
|
||
# Then | ||
self.assertDictEqual(result, {'foo_key': 'barValue'}) | ||
|
||
def test_toSnake_listOfDicts_ReturnsSnakeKeys(self): | ||
# Given | ||
input = [{'fooKey': 'barValue'}, {'barKey': 'fooValue'}] | ||
|
||
# When | ||
result = common.to_snake(input) | ||
|
||
# Then | ||
self.assertListEqual(result, [{'foo_key': 'barValue'}, {'bar_key': 'fooValue'}]) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 @@ | ||
first name,last name | ||
John ,Smith | ||
Jane ,Brown |
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,10 @@ | ||
--- | ||
buckets: | ||
- name: mybucket | ||
objects: | ||
- name: foo.csv | ||
content-type: text/csv | ||
path: ./s3-objects/foo.csv | ||
- name: test/bar.png | ||
content-type: image/png | ||
path: ./s3-objects/bar.png |
Oops, something went wrong.