Skip to content

Commit 02348bb

Browse files
committed
POP-2466 rename src directory to facilitate library usage & improve documentation
1 parent 05d0055 commit 02348bb

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,17 @@ to run the tests for this project.
4646

4747
Please use the [GitHub Issues](https://github.com/dynata/python-cmixapi-client/issues/new) to file an issue.
4848

49+
### Releasing
50+
51+
The release can be done completely on the command line:
52+
53+
git tag -a 0.1.0 -m "Initial release with minimal functionality used by PopResearch"
54+
git push origin 0.1.0
55+
python3 -m pip install --user --upgrade setuptools wheel
56+
python3 setup.py sdist bdist_wheel
57+
python3 -m pip install --user --upgrade twine
58+
python3 -m twine upload dist/*
59+
60+
but it's also a good idea to attach the `.whl` and `.tar.gz` files to the release in GitHub.
61+
4962
Thats it.
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# python-cmixapi-client
22

3+
[![PyPI version](https://badge.fury.io/py/python-cmixapi-client.svg)](https://pypi.org/project/python-cmixapi-client/)
4+
35
<a href="https://github.com/dynata/python-cmixapi-client/actions"><img alt="GitHub Actions status" src="https://github.com/dynata/python-cmixapi-client/workflows/python-tests/badge.svg"></a>
46

57
A Python client library for the [Dynata Cmix API](https://wiki2.criticalmix.net/display/CA/Getting+started).
@@ -38,7 +40,7 @@ A Python client library for the [Dynata Cmix API](https://wiki2.criticalmix.net/
3840

3941
## Contributing
4042

41-
Information on [contributing](CONTRIBUTING.md).
43+
Information on [contributing](https://github.com/dynata/python-cmixapi-client/blob/dev/CONTRIBUTING.md) to this python library.
4244

4345
## Testing
4446

tests/test_api.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import mock
55

66
from unittest import TestCase
7-
from src.api import CmixAPI, CMIX_SERVICES
8-
from src.error import CmixError
7+
from CmixAPIClient.api import CmixAPI, CMIX_SERVICES
8+
from CmixAPIClient.error import CmixError
99

1010

1111
def default_cmix_api():
@@ -72,15 +72,15 @@ def test_create_export_archive(self):
7272
self.assertEqual(response['response'], 1)
7373

7474
def test_create_export_archive_errors_handled(self):
75-
with mock.patch('src.api.requests.post') as mock_post:
75+
with mock.patch('CmixAPIClient.api.requests.post') as mock_post:
7676
mock_post_response = mock.Mock()
7777
mock_post_response.status_code = 200
7878
mock_post_response.json.return_value = {
7979
'response': 1,
8080
'error': 'Oops!',
8181
}
8282
mock_post.return_value = mock_post_response
83-
with mock.patch('src.api.requests.get') as mock_get:
83+
with mock.patch('CmixAPIClient.api.requests.get') as mock_get:
8484
# Check CmixError is raised if POST response JSON includes an error.
8585
mock_response = mock.Mock()
8686
mock_response.status_code = 200
@@ -95,7 +95,7 @@ def test_create_export_archive_errors_handled(self):
9595
# Remove error from POST response.
9696
mock_post_response.json.return_value = {'response': 1}
9797

98-
with mock.patch('src.api.requests.get') as mock_get:
98+
with mock.patch('CmixAPIClient.api.requests.get') as mock_get:
9999
# Check CmixError is raised on GET 500 response. (layout response)
100100
mock_response = mock.Mock()
101101
mock_response.status_code = 500
@@ -119,7 +119,7 @@ def test_create_export_archive_errors_handled(self):
119119
def test_get_survey_status(self):
120120
self.cmix_api._authentication_headers = {'Authentication': 'Bearer test'}
121121

122-
with mock.patch('src.api.requests') as mock_request:
122+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
123123
mock_get = mock.Mock()
124124
mock_get.status_code = 200
125125
mock_get.json.return_value = {'status': 'LIVE'}
@@ -134,7 +134,7 @@ def test_get_survey_status(self):
134134
def test_get_survey_status_error_handled(self):
135135
self.cmix_api._authentication_headers = {'Authentication': 'Bearer test'}
136136

137-
with mock.patch('src.api.requests') as mock_request:
137+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
138138
mock_get = mock.Mock()
139139
mock_get.status_code = 200
140140
mock_get.json.return_value = {}
@@ -148,7 +148,7 @@ def test_get_survey_test_url(self):
148148
correct_test_link = '{}/#/?cmixSvy={}&cmixTest={}'.format(
149149
CMIX_SERVICES['test']['BASE_URL'], self.survey_id, 'test')
150150

151-
with mock.patch('src.api.requests') as mock_request:
151+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
152152
mock_get = mock.Mock()
153153
mock_get.status_code = 200
154154
mock_get.json.return_value = {'testToken': 'test'}
@@ -158,7 +158,7 @@ def test_get_survey_test_url(self):
158158

159159
def test_get_survey_test_url_no_token_handled(self):
160160
self.cmix_api._authentication_headers = {'Authentication': 'Bearer test'}
161-
with mock.patch('src.api.requests') as mock_request:
161+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
162162
mock_get = mock.Mock()
163163
mock_get.status_code = 200
164164
mock_get.json.return_value = {}
@@ -168,7 +168,7 @@ def test_get_survey_test_url_no_token_handled(self):
168168
self.cmix_api.get_survey_test_url(self.survey_id)
169169

170170
def test_get_survey_completes(self):
171-
with mock.patch('src.api.requests') as mock_request:
171+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
172172
mock_post = mock.Mock()
173173
mock_post.status_code = 200
174174
mock_post.json.return_value = {
@@ -184,7 +184,7 @@ def test_get_survey_completes(self):
184184
self.assertEqual(self.cmix_api.get_survey_completes(self.survey_id), mock_respondents)
185185

186186
def test_get_surveys(self):
187-
with mock.patch('src.api.requests') as mock_request:
187+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
188188
mock_post = mock.Mock()
189189
mock_post.status_code = 200
190190
mock_post.json.return_value = {
@@ -208,7 +208,7 @@ def test_get_surveys(self):
208208
mock_request.get.assert_any_call(expected_url_with_params, headers=self.cmix_api._authentication_headers)
209209

210210
def test_fetch_banner_filter(self):
211-
with mock.patch('src.api.requests') as mock_request:
211+
with mock.patch('CmixAPIClient.api.requests') as mock_request:
212212
mock_post = mock.Mock()
213213
mock_post.status_code = 200
214214
mock_post.json.return_value = {
@@ -245,7 +245,7 @@ def test_get_archive_status(self):
245245
survey_id = 1337
246246
archive_id = 12
247247
layout_id = 1
248-
with mock.patch('src.api.requests.get') as mock_request:
248+
with mock.patch('CmixAPIClient.api.requests.get') as mock_request:
249249
mock_response = mock.Mock()
250250
mock_response.status_code = 200
251251
mock_response.json.return_value = {

0 commit comments

Comments
 (0)