File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
2-
32"""pytest configuration and top-level fixtures."""
43
5- import pytest
64
5+ import string
76
8- EMAIL_ADDRESSES = [
9- 'test98@cmlccie.com' ,
10- 'test99@cmlccie.com' ,
11- ]
7+ import pytest
128
139
1410pytest_plugins = [
2117 'tests.api.test_teammemberships' ,
2218 'tests.api.test_teams' ,
2319 'tests.api.test_webhooks' ,
20+ 'tests.api.test_organizations' ,
21+ 'tests.api.test_licenses' ,
22+ 'tests.api.test_roles' ,
2423]
2524
2625
26+ TEST_DOMAIN = "cmlccie.com"
27+
28+ email_template = string .Template ("test${number}@" + TEST_DOMAIN )
29+ _email_addresses = []
30+
31+
32+ # Helper Functions
33+ def new_email_generator ():
34+ i = 0
35+ while True :
36+ email_address = email_template .substitute (number = i )
37+ _email_addresses .append (email_address )
38+ i += 1
39+ yield email_address
40+
41+
2742# pytest Fixtures
2843
2944@pytest .fixture (scope = "session" )
3045def email_addresses ():
31- return EMAIL_ADDRESSES
46+ return _email_addresses
47+
48+
49+ @pytest .fixture (scope = "session" )
50+ def get_email_addresses ():
51+ def inner_function (num ):
52+ if len (email_addresses ) < num :
53+ for i in range (num - len (email_addresses )):
54+ new_email_address ()
55+ return email_addresses [:num ]
56+ return inner_function
57+
58+
59+ @pytest .fixture (scope = "session" )
60+ def get_new_email_address ():
61+ generator = new_email_generator ()
62+ def inner_function ():
63+ return generator .next ()
64+ return inner_function
You can’t perform that action at this time.
0 commit comments