|
11 | 11 | client_id = os.environ.get("BITWARDEN_CLIENT_ID", None) |
12 | 12 | client_secret = os.environ.get("BITWARDEN_CLIENT_SECRET", None) |
13 | 13 | device_id = os.environ.get("BITWARDEN_DEVICE_ID", None) |
14 | | -bitwarden = BitwardenAPIClient( |
15 | | - url, email, password, client_id, client_secret, device_id |
16 | | -) |
17 | 14 |
|
18 | 15 | # Get test organization id from environment variables |
19 | 16 | test_organization = os.environ.get("BITWARDEN_TEST_ORGANIZATION", None) |
20 | 17 |
|
| 18 | +client_with_mail = BitwardenAPIClient( |
| 19 | + url, |
| 20 | + email, |
| 21 | + password, |
| 22 | + client_id, |
| 23 | + client_secret, |
| 24 | + device_id, |
| 25 | +) |
| 26 | + |
| 27 | +client_without_mail = BitwardenAPIClient( |
| 28 | + url, |
| 29 | + None, |
| 30 | + password, |
| 31 | + client_id, |
| 32 | + client_secret, |
| 33 | + device_id, |
| 34 | +) |
21 | 35 |
|
22 | | -class BitwardenBasic(unittest.TestCase): |
23 | | - def setUp(self) -> None: |
24 | | - self.organization = get_organization(bitwarden, test_organization) |
| 36 | +class BitwardenBaseTests: |
| 37 | + def setUpBase(self): |
| 38 | + self.organization = get_organization(self.bitwarden, test_organization) |
25 | 39 | self.test_colls_names = self.organization.collections(as_dict=True) |
26 | 40 | self.test_colls_ids = self.organization.collections() |
27 | 41 | self.test_users = self.organization.users() |
@@ -127,6 +141,15 @@ def test_deduplicate(self): |
127 | 141 | # Todo build test fixtures and delete them at the end of the test |
128 | 142 | return |
129 | 143 |
|
| 144 | +class BitwardenWithEmailTests(unittest.TestCase, BitwardenBaseTests): |
| 145 | + def setUp(self): |
| 146 | + self.bitwarden = client_with_mail |
| 147 | + self.setUpBase() |
| 148 | + |
| 149 | +class BitwardenWithoutEmailTests(unittest.TestCase, BitwardenBaseTests): |
| 150 | + def setUp(self): |
| 151 | + self.bitwarden = client_without_mail |
| 152 | + self.setUpBase() |
130 | 153 |
|
131 | 154 | if __name__ == "__main__": |
132 | 155 | unittest.main() |
0 commit comments