Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pytest
- import time
- from lxml import etree
- from uuid import uuid1
- import common.nexmo_requests as requests
- from common.mysql_db import MySQL_db as mysql
- from common.provisioning import PhubAccountCommands, PhubAccountResponse, get_account
- from conf.nexmo_config import Server, User
- def create_account_xml(username, **attributes):
- """Creates an account xml node with a given username using a phub command.
- It also allows you to provide a map of extra attributes instead of using
- the defaults
- """
- # defaults
- account_attributes = {
- "sysid": username,
- "password": "HARbour123!321roubRAH",
- "max-binds": "5",
- "max-mt-per-second": "5",
- "max-mo-per-second": "5",
- "smpp-enabled": "true"
- }
- if attributes is not None:
- account_attributes.update(attributes)
- account = etree.Element("account", account_attributes)
- return etree.tostring(account)
- @pytest.mark.trusted
- def test_create_secret_sign_T_F():
- """TEST: creating an account - should work
- developer: yana.angelova
- pre-requisites: none.
- notes: the first call create account - it is with missing param but should create secret signature.
- """
- username = "reporting_qod"
- account_xml = create_account_xml(username)
- test_params = {
- "cmd": PhubAccountCommands.CREATE_ACCOUNT,
- "xml": account_xml
- }
- response = requests.get(Server.PHUB, params=test_params).json()
- get1 = get_account(username)
- account_xml = create_account_xml(username, password="reporting_qod")
- test_params = {
- "cmd": PhubAccountCommands.UPDATE_ACCOUNT,
- "xml": account_xml #true value is updating the signature
- }
- response = requests.get(Server.PHUB, params=test_params).json()
- get1 = get_account(username)
- if __name__ == "__main__":
- pytest.main([__file__, "-k", "test_", "-v", "-s"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement