Skip to content
Merged

Next #23

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
loaded install, changlog , codeowners and release.yml file
  • Loading branch information
sunil-lakshman committed May 23, 2023
commit 6944e1c362fa0d5e141987d87b64b7dcc7419986
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
# help make automated releases for this project

name: Release

on:
release:
types: [created]

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install build dependencies
run: python -m pip install -U setuptools wheel build
- name: Build
run: python -m build .
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
skip_existing: true
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ fileignoreconfig:
checksum: 55b60bc69e941184bf16697cec82f5e14369460259729bbbd62437e019e6ab60
- filename: contentstack_management/core/client.py
checksum: 1bec47304a29a7c482f530e3ac283e8ddd8fa96f99153833feac5a6513d726df
- filename: .github/workflows/release.yml
checksum: d2ea9ae192ae0f1b75ff2b68b6bcd9d40eb86d589fb2177535b93194d69a9e0e
- filename: tests/test_user_session.py
checksum: f5000644a471e6ac4ee5bfcb5cfc73762e53fa97980951063f787a83e97244f9
version: ""
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# CHANGELOG

1 change: 1 addition & 0 deletions CODEOWNERS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @contentstack/security-admin @contentstack/sdk-admin
7 changes: 7 additions & 0 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

To install the package simply run the below command on your terminal:

python setup.py install

Don't forget to file bugs and let me know about them.
Also, don't hesitate to ask for new features. Happy coding.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "contentstack-management",
"version": "0.0.1",
"developer": "sunil-lakshman",
"license": "MIT",
"author": { "name": "sunil-lakshman", "email": "sunil.lakshman@contentstack.com" },
"homepage": "www.contentstack.com",
"readme": "./readme"
}
45 changes: 45 additions & 0 deletions tests/test_user_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import unittest
import requests
import os

from contentstack_management import contentstack

class UserSessionTests(unittest.TestCase):

@classmethod
def setUpClass(cls):
# Retrieve secret credentials from environment variables
cls.username = os.environ.get('API_USERNAME')
cls.password = os.environ.get('API_PASSWORD')

def test_successful_get_request(self):
response = requests.get('https://api.example.com/data')
self.assertEqual(response.status_code, 200)
# Additional assertions to validate the response content

def test_invalid_url(self):
response = requests.get('https://api.example.com/invalid')
self.assertEqual(response.status_code, 404)
# Additional assertions for error handling

def test_request_timeout(self):
response = requests.get('https://api.example.com/slow', timeout=2)
self.assertEqual(response.status_code, 408)
# Additional assertions for handling timeouts

def test_request_headers(self):
headers = {'User-Agent': 'My User Agent'}
response = requests.get('https://api.example.com/data', headers=headers)
self.assertEqual(response.status_code, 200)
# Additional assertions for validating headers in response

def test_authentication(self):
credentials = (self.username, self.password)
response = requests.get('https://api.example.com/data', auth=credentials)
self.assertEqual(response.status_code, 200)
# Additional assertions for successful authentication



if __name__ == '__main__':
unittest.main()