Advertisement
Guest User

Untitled

a guest
Mar 7th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. import pytest
  2. import time
  3. from lxml import etree
  4. from uuid import uuid1
  5. import common.nexmo_requests as requests
  6. from common.mysql_db import MySQL_db as mysql
  7. from common.provisioning import PhubAccountCommands, PhubAccountResponse, get_account
  8. from conf.nexmo_config import Server, User
  9.  
  10.  
  11.  
  12. def create_account_xml(username, **attributes):
  13. """Creates an account xml node with a given username using a phub command.
  14. It also allows you to provide a map of extra attributes instead of using
  15. the defaults
  16. """
  17. # defaults
  18. account_attributes = {
  19. "sysid": username,
  20. "password": "HARbour123!321roubRAH",
  21. "max-binds": "5",
  22. "max-mt-per-second": "5",
  23. "max-mo-per-second": "5",
  24. "smpp-enabled": "true"
  25. }
  26.  
  27. if attributes is not None:
  28. account_attributes.update(attributes)
  29.  
  30. account = etree.Element("account", account_attributes)
  31.  
  32. return etree.tostring(account)
  33.  
  34. @pytest.mark.trusted
  35. def test_create_secret_sign_T_F():
  36. """TEST: creating an account - should work
  37. developer: yana.angelova
  38. pre-requisites: none.
  39. notes: the first call create account - it is with missing param but should create secret signature.
  40. """
  41. username = "reporting_qod"
  42.  
  43. account_xml = create_account_xml(username)
  44.  
  45. test_params = {
  46. "cmd": PhubAccountCommands.CREATE_ACCOUNT,
  47. "xml": account_xml
  48. }
  49.  
  50. response = requests.get(Server.PHUB, params=test_params).json()
  51. get1 = get_account(username)
  52. account_xml = create_account_xml(username, password="reporting_qod")
  53. test_params = {
  54. "cmd": PhubAccountCommands.UPDATE_ACCOUNT,
  55. "xml": account_xml #true value is updating the signature
  56. }
  57. response = requests.get(Server.PHUB, params=test_params).json()
  58. get1 = get_account(username)
  59.  
  60. if __name__ == "__main__":
  61. pytest.main([__file__, "-k", "test_", "-v", "-s"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement