# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['ethel', 'ethel.api']

package_data = \
{'': ['*'], 'ethel.api': ['payloads/*']}

install_requires = \
['Jinja2', 'pyyaml', 'requests']

setup_kwargs = {
    'name': 'ethel',
    'version': '3.0.0rc2',
    'description': 'Account Management Tool for Testing',
    'long_description': '# Ethel\n\nEthel is a tool that allows you to manipulate with accounts in Stage, QA or any other environment, buy Subscriptions, activate them and do other chores.\n\n## Instalation\n\n```sh\npip install ethel\n```\n\n## Usage\n\n### Prerequisites\n\nBefore you can use Ethel, you have to set up your environment accordingly:\n\n```sh\n# Required:\nEBS_CERT_PUBLIC=<PATH_TO_EBS_SSL_CLIENT_CERTIFICATE>\nEBS_CERT_KEY=<PATH_TO_EBS_SSL_CLIENT_CERTIFICATE_KEY>\n\n# Optional:\nCANDLEPIN_USERNAME=<CANDLEPIN_SUPERUSER_USERNAME>  # Defaults to "candlepin_admin"\nCANDLEPIN_PASSWORD=<CANDLEPIN_SUPERUSER_PASSWORD>  # Defaults to "candlepin_admin"\n```\n\n### Basic usage\n\nThe most basic usecase is to simply create an account and subscribe it to a product.\n\n```python\n>>> from ethel import Ethel\n\n>>> ethel = Ethel.stage()\n\n>>> account = ethel.create_account(\'some_fancy_username\', \'not_so_secret_password\')\n\n>>> account.subscribe(\'product_sku\')\n```\n\nEthel provides access to Stage and QA environments via `Ethel.stage()` and `Ethel.qa()` class methods.\n\n### Advanced usage\n\nEthel, by default, processes everything for you when the account is being created. Also, if account with the same username already exists, Ethel verifies your credentials and returns you the already existant account entry.\n\nWhen account is being created, Ethel ensures that it\'s Candlepins owners are created (forces Candlepin refresh) and accepts all required Terms and Conditions. To disable this behavior, you can pass `create_owners=False` and/or `accept_terms=False` when creating account and do it yourself later:\n\n```python\n>>> account = ethel.create_account(\n... "some_fancy_username",\n... "not_so_secret_password",\n... first_name="Gretchen",\n... last_name="SomeOldSurname",\n... email="grandmas.dont.have@emails.com",\n... create_owners=False,\n... accept_terms=False,\n... )\n\n>>> account.start_refresh()\n\n>>> account.get_refresh_status()\n\'RUNNING\'\n\n>>> account.get_refresh_status()\n\'FINISHED\'\n\n>>> account.accept_all_terms(optional=True)  # Accepts also the optional Terms and Conditions\n```\n\nYou can also specify more details about your desired subscription when asking Ethel to subscribe it you your account:\n\n```python\n>>> account.subscribe(\n... \'product_sku\',\n... quantity=42,\n... start_date=\'yesterday\',  # accepts \'yesterday\', \'today\', \'tomorrow\', ISO date \'YYYY-MM-DD\' or datetime.date\n... duration=365 # accepts integer that means \'days\' or datetime.timedelta\n... )\n```\n\n### Errors and Exceptions\n\nIf an exception is returned to Ethel from either Candlepin or the EBS rest API services, they are unified and interfaced as an `EthelError`. Depending on the exact API that raised the exception, the level of detail varies. Following properties are stored:\n\n- `message` - Should contain the reason why the exception occurred.\n- `message_type` - Class of the exception reason description (different to `exception_type`).\n- `exception_type` - Type of exception (class name).\n- `status_code` - HTTP status code (EBS likes to return HTTP_500 for any reason).\n- `source` - API that caused the exception.\n- `uuid` - Exception\'s tracking code for Candlepin API.\n- `raw_error` - `HTTPError` object providing access to `PreparedRequest` and `Response` directly.\n\nEthel does not handle `requests.ConnectionError` and `requests.Timeout`. **For convenience a shorthand `EthelConnectionError` is provided.** Ethel doesn\'t retry any request, it\'s up to user to handle this behavior.\n\n```python\n>>> account = ethel.create_account(\'USERNAME\', \'WRONG_PASSWORD\')\nEthelError: From: Candlepin(api_base_url=<CANDLEPIN_URL_FOR_THIS_ENV>). Reason: Invalid user credentials. Status code: 401. Call(method=GET, url=<CANDLEPIN_URL_FOR_THIS_ENV>)/users/<USERNAME>/owners).\n\n>>> try:\n...     account = ethel.create_account(\'<USERNAME>\', \'<WRONG_PASSWORD>\')\n... except EthelError as e:\n...     logging.error("Status Code %d, Message: %s, Tracking code %s" % (e.status_code, e.message, e.uuid))\n\nERROR:root:Status Code 401, Message: Invalid user credentials, Tracking code e7275480-2c59-42fa-a6db-b8df6a9dc323\n```\n\n### Additional properties\n\nEthel stores few important properties for each of your accounts that might be usefull to you:\n\n- Organization ID\n- Candlepin Owner ID\n- List of all Subscription orders done in this session\n- List of all Activation orders done in this session\n\n```python\n>>> account.org_id\n123456789\n\n>>> account.owner_id\n987654321\n\n>>> account.orders\n[...]\n\n>>> account.activations\n[...]\n```\n\n### View Account\n\nAnd since Ethel allows you to have a Black Friday for subscriptions everyday, you may want to look up all the things you\'ve bought:\n\n```python\n>>> account.list_pools()  # You can pass future=True argument to list also pools valid in future\n[\n    {\n        \'pool_id\': \'<USE_THIS_TO_SUBSCRIBE>\',\n        \'sku_id\': \'<PRODUCT_SKU_ID>\',\n        \'product_name\': \'Fancy Product Name\',\n        \'start_date\': \'2020-02-07T05:00:00+0000\',\n        \'end_date\': \'2021-02-07T04:59:59+0000\',\n        \'muiltiplier\': None,\n        \'quantity\': \'unlimited\',\n        \'instance_multiplier\': None\n    },\n    {\n        \'pool_id\': \'<ALSO_USE_THIS_TO_SUBSCRIBE>\',\n        \'sku_id\': \'<ANOTHER_PRODUCT_SKU_ID>\',\n        \'product_name\': \'Fancy Product Name\',\n        \'start_date\': \'2020-02-06T05:00:00+0000\',\n        \'end_date\': \'2021-02-06T04:59:59+0000\',\n        \'muiltiplier\': None,\n        \'quantity\': 1,\n        \'instance_multiplier\': 16\n    },\n    ...\n]\n```\n\n## Developer setup\n\nAfter cloning this repo, setup the local environment via [Poetry](https://python-poetry.org/):\n\n```sh\npoetry install\n```\n\n### Prepared tasks\n\n- `poetry run task lint` - runs [Mypy](http://mypy-lang.org/) and [Pylint](https://www.pylint.org/)\n- `poetry run task test` - runs [Pytest](https://docs.pytest.org/en/latest/) test suite\n',
    'author': 'Tomas Coufal',
    'author_email': 'tcoufal@redhat.com',
    'maintainer': 'Tomas Coufal',
    'maintainer_email': 'tcoufal@redhat.com',
    'url': 'https://github.com/tumido/ethel',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
