Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import sys
  2. import unittest
  3. import xmlrunner
  4.  
  5.  
  6. def env_set(environment):
  7. test_env = 'http://lolo-test.com'
  8. dev_env = 'http://lolo-dev.com'
  9. prod_env = 'http://lolo-prod.com'
  10.  
  11. if environment:
  12. if environment == 'test':
  13. return test_env
  14. elif environment == 'dev':
  15. return dev_env
  16. elif environment == 'prod':
  17. return prod_env
  18. else:
  19. print(f'There is no environment like: {environment}, setting up default test env: {test_env}')
  20. return test_env
  21. else:
  22. print(f'No environment specified, setting up default test env: {test_env}')
  23. return test_env
  24.  
  25.  
  26. class TestLogin(unittest.TestCase):
  27. ENV = ''
  28.  
  29. def setUp(self):
  30. self.base_url = env_set(self.ENV)
  31.  
  32. def test_logins_or_something(self):
  33. print(self.base_url)
  34.  
  35.  
  36. if __name__ == "__main__":
  37. if len(sys.argv) > 1:
  38. TestLogin.ENV = sys.argv.pop()
  39. unittest.main(
  40. testRunner=xmlrunner.XMLTestRunner(output='test-reports'),
  41. # these make sure that some options that are not applicable
  42. # remain hidden from the help menu.
  43. failfast=False, buffer=False, catchbreak=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement