()
| 35 | |
| 36 | |
| 37 | def test_resource_methods(): |
| 38 | keys = SXTKeyManager(new_keypair=True) |
| 39 | rs = SXTResource('Test') |
| 40 | userA = SXTUser(user_id='A', user_private_key=keys.private_key, api_key='') |
| 41 | userB = SXTUser(user_id='B', user_private_key='', api_key='') |
| 42 | userE = SXTUser(user_id='E', api_key='') |
| 43 | userE.key_manager = SXTKeyManager() |
| 44 | userO = object() |
| 45 | userS = 'just a string, man' |
| 46 | userK = SXTUser(api_key='sxt_apikey123') |
| 47 | userRS = SXTUser(user_id='RS', user_private_key=keys.private_key) |
| 48 | rs.user = userRS |
| 49 | |
| 50 | assert rs.get_first_valid_user(userO, userS, userE, userA, userB) == userA |
| 51 | assert rs.get_first_valid_user(userS, userB, userA, userE) == userA |
| 52 | assert rs.get_first_valid_user(userA, userB, userO, userS) == userA |
| 53 | assert rs.get_first_valid_user(userS, userRS, userB, userA, userO) == userRS |
| 54 | assert rs.get_first_valid_user() == userRS |
| 55 | |
| 56 | assert rs.get_first_valid_user(userE, userS) == userRS |
| 57 | rs.user = userO |
| 58 | assert rs.get_first_valid_user(userE, userS) == userE |
| 59 | assert rs.get_first_valid_user(userS, userO) == None |
| 60 | |
| 61 | |
| 62 | def test_inserts_deletes_updates(): |
nothing calls this directly
no test coverage detected