Skip to content

Commit 6944e1c

Browse files
loaded install, changlog , codeowners and release.yml file
1 parent 4c7f587 commit 6944e1c

File tree

7 files changed

+96
-0
lines changed

7 files changed

+96
-0
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
2+
# help make automated releases for this project
3+
4+
name: Release
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build-and-publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
- name: Set up Python
17+
uses: actions/setup-python@v1
18+
with:
19+
python-version: '3.x'
20+
- name: Install build dependencies
21+
run: python -m pip install -U setuptools wheel build
22+
- name: Build
23+
run: python -m build .
24+
- name: Publish
25+
uses: pypa/gh-action-pypi-publish@master
26+
with:
27+
password: ${{ secrets.pypi_password }}
28+
skip_existing: true

.talismanrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ fileignoreconfig:
77
checksum: 55b60bc69e941184bf16697cec82f5e14369460259729bbbd62437e019e6ab60
88
- filename: contentstack_management/core/client.py
99
checksum: 1bec47304a29a7c482f530e3ac283e8ddd8fa96f99153833feac5a6513d726df
10+
- filename: .github/workflows/release.yml
11+
checksum: d2ea9ae192ae0f1b75ff2b68b6bcd9d40eb86d589fb2177535b93194d69a9e0e
12+
- filename: tests/test_user_session.py
13+
checksum: f5000644a471e6ac4ee5bfcb5cfc73762e53fa97980951063f787a83e97244f9
1014
version: ""

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# CHANGELOG
2+

CODEOWNERS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @contentstack/security-admin @contentstack/sdk-admin

INSTALL.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
To install the package simply run the below command on your terminal:
3+
4+
python setup.py install
5+
6+
Don't forget to file bugs and let me know about them.
7+
Also, don't hesitate to ask for new features. Happy coding.

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "contentstack-management",
3+
"version": "0.0.1",
4+
"developer": "sunil-lakshman",
5+
"license": "MIT",
6+
"author": { "name": "sunil-lakshman", "email": "sunil.lakshman@contentstack.com" },
7+
"homepage": "www.contentstack.com",
8+
"readme": "./readme"
9+
}

tests/test_user_session.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import unittest
2+
import requests
3+
import os
4+
5+
from contentstack_management import contentstack
6+
7+
class UserSessionTests(unittest.TestCase):
8+
9+
@classmethod
10+
def setUpClass(cls):
11+
# Retrieve secret credentials from environment variables
12+
cls.username = os.environ.get('API_USERNAME')
13+
cls.password = os.environ.get('API_PASSWORD')
14+
15+
def test_successful_get_request(self):
16+
response = requests.get('https://api.example.com/data')
17+
self.assertEqual(response.status_code, 200)
18+
# Additional assertions to validate the response content
19+
20+
def test_invalid_url(self):
21+
response = requests.get('https://api.example.com/invalid')
22+
self.assertEqual(response.status_code, 404)
23+
# Additional assertions for error handling
24+
25+
def test_request_timeout(self):
26+
response = requests.get('https://api.example.com/slow', timeout=2)
27+
self.assertEqual(response.status_code, 408)
28+
# Additional assertions for handling timeouts
29+
30+
def test_request_headers(self):
31+
headers = {'User-Agent': 'My User Agent'}
32+
response = requests.get('https://api.example.com/data', headers=headers)
33+
self.assertEqual(response.status_code, 200)
34+
# Additional assertions for validating headers in response
35+
36+
def test_authentication(self):
37+
credentials = (self.username, self.password)
38+
response = requests.get('https://api.example.com/data', auth=credentials)
39+
self.assertEqual(response.status_code, 200)
40+
# Additional assertions for successful authentication
41+
42+
43+
44+
if __name__ == '__main__':
45+
unittest.main()

0 commit comments

Comments
 (0)