Best Python code snippet using localstack_python
test_rules.py
Source:test_rules.py
...8 resp = client.get('/v1/teams/{}/rules'.format(team_id))9 assert resp.status_code == 40310 for role in ['member', 'editor', 'manager']:11 user_id = str(create_user(role)['id'])12 create_grant(team_id, user_id, role)13 client.login(role)14 resp = client.get('/v1/teams/{}/rules'.format(team_id))15 assert resp.status_code == 20016def test_list_rules_notfound(client):17 client.login('depc')18 resp = client.get('/v1/teams/notfound/rules')19 assert resp.status_code == 40420def test_list_rules(client, create_team, create_user, create_grant, create_rule, create_source, create_check, add_check):21 user_id = str(create_user('depc')['id'])22 team_id = str(create_team('My team')['id'])23 create_grant(team_id, user_id, 'member')24 client.login('depc')25 resp = client.get('/v1/teams/{}/rules'.format(team_id))26 assert resp.status_code == 20027 assert resp.json == {'rules': []}28 rule_id = str(create_rule('My rule', team_id)['id'])29 resp = client.get('/v1/teams/{}/rules'.format(team_id))30 assert resp.status_code == 20031 assert resp.json == {32 'rules': [{33 'name': 'My rule',34 'description': None,35 'checks': []36 }]37 }38 source_id = str(create_source('My source', team_id)['id'])39 check_id = str(create_check('My check', source_id, 'Threshold', {'metric': 'foo', 'threshold': "100"})['id'])40 add_check(rule_id, [check_id])41 resp = client.get('/v1/teams/{}/rules'.format(team_id))42 assert resp.status_code == 20043 assert resp.json == resp.json == {44 'rules': [{45 'name': 'My rule',46 'description': None,47 'checks': [{48 'name': 'My check',49 'parameters': {'metric': 'foo', 'threshold': "100"},50 'source_id': source_id,51 'type': 'Threshold'52 }]53 }]54 }55 for i in range(9):56 create_rule('Rule {}'.format(i), team_id)57 resp = client.get('/v1/teams/{}/rules'.format(team_id))58 assert resp.status_code == 20059 assert len(resp.json['rules']) == 1060def test_get_rule_authorization(client, create_team, create_rule, create_user, create_grant):61 team_id = str(create_team('My team')['id'])62 rule_id = str(create_rule('My rule', team_id)['id'])63 resp = client.get('/v1/teams/{}/rules/{}'.format(team_id, rule_id))64 assert resp.status_code == 40165 client.login('depc')66 resp = client.get('/v1/teams/{}/rules/{}'.format(team_id, rule_id))67 assert resp.status_code == 40368 for role in ['member', 'editor', 'manager']:69 user_id = str(create_user(role)['id'])70 create_grant(team_id, user_id, role)71 client.login(role)72 resp = client.get('/v1/teams/{}/rules/{}'.format(team_id, rule_id))73 assert resp.status_code == 20074def test_get_rule_notfound(client, create_team, create_user, create_grant):75 team_id = str(create_team('My team')['id'])76 user_id = str(create_user('depc')['id'])77 create_grant(team_id, user_id, 'member')78 client.login('depc')79 resp = client.get('/v1/teams/{}/rules/notfound'.format(team_id))80 assert resp.status_code == 40481def test_get_rule(client, create_team, create_rule, create_user, create_grant, create_source, create_check, add_check):82 user_id = str(create_user('depc')['id'])83 team_id = str(create_team('My team')['id'])84 create_grant(team_id, user_id, 'member')85 rule_id = str(create_rule('My rule', team_id)['id'])86 client.login('depc')87 resp = client.get('/v1/teams/{}/rules/{}'.format(team_id, rule_id))88 assert resp.status_code == 20089 assert resp.json == {90 'name': 'My rule',91 'description': None,92 'checks': []93 }94 source_id = str(create_source('My source', team_id)['id'])95 check_id = str(create_check('My check', source_id, 'Threshold', {'metric': 'foo', 'threshold': "100"})['id'])96 add_check(rule_id, [check_id])97 resp = client.get('/v1/teams/{}/rules/{}'.format(team_id, rule_id))98 assert resp.status_code == 20099 assert resp.json == resp.json == {100 'name': 'My rule',101 'description': None,102 'checks': [{103 'name': 'My check',104 'parameters': {'metric': 'foo', 'threshold': "100"},105 'source_id': source_id,106 'type': 'Threshold'107 }]108 }109def test_post_rule_authorization(client, create_team, create_user, create_grant):110 team_id = str(create_team('My team')['id'])111 post_data = {'name': 'My rule'}112 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps(post_data))113 assert resp.status_code == 401114 client.login('depc')115 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps(post_data))116 assert resp.status_code == 403117 roles = {'member': 403, 'editor': 201, 'manager': 201}118 for role, status in roles.items():119 user_id = str(create_user(role)['id'])120 create_grant(team_id, user_id, role)121 client.login(role)122 resp = client.post(123 '/v1/teams/{}/rules'.format(team_id),124 data=json.dumps({'name': 'My {} rule'.format(role)})125 )126 assert resp.status_code == status127def test_post_rule_notfound(client):128 client.login('depc')129 resp = client.post('/v1/teams/notfound/rules', data=json.dumps({'name': 'My rule'}))130 assert resp.status_code == 404131def test_post_rule(client, create_team, create_user, create_grant):132 user_id = str(create_user('depc')['id'])133 team_id = str(create_team('My team')['id'])134 create_grant(team_id, user_id, 'manager')135 client.login('depc')136 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps({}))137 assert resp.raises_required_property('name')138 post_data = {'name': 'My rule', 'additional': 'property'}139 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps(post_data))140 assert resp.status_code == 400141 assert 'Additional properties are not allowed' in resp.json['message']142 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps({'name': 'My rule'}))143 assert resp.status_code == 201144 assert resp.json == {145 'name': 'My rule',146 'description': None,147 'checks': []148 }149 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps({'name': 'My rule'}))150 assert resp.status_code == 409151 resp = client.post(152 '/v1/teams/{}/rules'.format(team_id),153 data=json.dumps({'name': 'My second rule', 'description': 'My description'})154 )155 assert resp.status_code == 201156 assert resp.json == {157 'name': 'My second rule',158 'description': 'My description',159 'checks': []160 }161def test_put_rule_authorization(client, create_team, create_rule, create_user, create_grant):162 team_id = str(create_team('My team')['id'])163 rule_id = str(create_rule('My rule', team_id)['id'])164 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({}))165 assert resp.status_code == 401166 client.login('depc')167 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({}))168 assert resp.status_code == 403169 roles = {'member': 403, 'editor': 200, 'manager': 200}170 for role, status in roles.items():171 user_id = str(create_user(role)['id'])172 create_grant(team_id, user_id, role)173 client.login(role)174 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({}))175 assert resp.status_code == status176def test_put_rule_notfound(client, create_team, create_rule, create_user, create_grant):177 team_id = str(create_team('My team')['id'])178 rule_id = str(create_rule('My rule', team_id)['id'])179 user_id = str(create_user('manager')['id'])180 create_grant(team_id, user_id, 'manager')181 client.login('manager')182 resp = client.put('/v1/teams/notfound/rules/{}'.format(rule_id), data=json.dumps({}))183 assert resp.status_code == 404184 resp = client.put('/v1/teams/{}/rules/notfound'.format(team_id), data=json.dumps({}))185 assert resp.status_code == 404186def test_put_rule(client, create_team, create_rule, create_user, create_grant):187 team_id = str(create_team('My team')['id'])188 rule_id = str(create_rule('My rule', team_id)['id'])189 user_id = str(create_user('manager')['id'])190 create_grant(team_id, user_id, 'manager')191 client.login('manager')192 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({'additional': 'property'}))193 assert resp.status_code == 400194 assert 'Additional properties are not allowed' in resp.json['message']195 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({'name': 'My edited rule'}))196 assert resp.status_code == 200197 assert resp.json == {198 'checks': [],199 'name': 'My edited rule',200 'description': None201 }202def test_put_rule_with_config(client, create_team, create_rule, create_user, create_grant, create_config):203 team_id = str(create_team('My team')['id'])204 rule_id = str(create_rule('MyRule', team_id)['id'])205 user_id = str(create_user('manager')['id'])206 create_grant(team_id, user_id, 'manager')207 create_config(team_id, {'myLabel': {'qos': 'rule.MyRule'}})208 client.login('manager')209 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({'name': 'My edited rule'}))210 assert resp.status_code == 409211 assert resp.json == {212 'message': 'Rule MyRule is used in your configuration, please remove it before.'213 }214def test_delete_rule_authorization(client, create_team, create_rule, create_user, create_grant):215 team_id = str(create_team('My team')['id'])216 rule_id = str(create_rule('My rule', team_id)['id'])217 resp = client.delete('/v1/teams/{}/rules/{}'.format(team_id, rule_id))218 assert resp.status_code == 401219 client.login('depc')220 resp = client.delete('/v1/teams/{}/rules/{}'.format(team_id, rule_id))221 assert resp.status_code == 403222 roles = {'member': 403, 'editor': 200, 'manager': 200}223 for role, status in roles.items():224 rule_id = str(create_rule('My {} rule'.format(role), team_id)['id'])225 user_id = str(create_user(role)['id'])226 create_grant(team_id, user_id, role)227 client.login(role)228 resp = client.delete('/v1/teams/{}/rules/{}'.format(team_id, rule_id))229 assert resp.status_code == status230def test_delete_rule_notfound(client, create_team, create_rule, create_user, create_grant):231 team_id = str(create_team('My team')['id'])232 rule_id = str(create_rule('My rule', team_id)['id'])233 user_id = str(create_user('manager')['id'])234 create_grant(team_id, user_id, 'manager')235 client.login('manager')236 resp = client.delete('/v1/teams/notfound/rules/{}'.format(rule_id), data=json.dumps({}))237 assert resp.status_code == 404238 resp = client.put('/v1/teams/{}/rule/notfound'.format(team_id), data=json.dumps({}))239 assert resp.status_code == 404240def test_delete_rule(client, create_team, create_rule, create_user, create_grant):241 team_id = str(create_team('My team')['id'])242 rule_id = str(create_rule('My rule', team_id)['id'])243 user_id = str(create_user('manager')['id'])244 create_grant(team_id, user_id, 'manager')245 client.login('manager')246 resp = client.delete('/v1/teams/{}/rules/{}'.format(team_id, rule_id))247 assert resp.status_code == 200248 assert resp.json == {}249def test_delete_rule_with_config(client, create_team, create_rule, create_user, create_grant, create_config):250 team_id = str(create_team('My team')['id'])251 rule_id = str(create_rule('MyRule', team_id)['id'])252 user_id = str(create_user('manager')['id'])253 create_grant(team_id, user_id, 'manager')254 create_config(team_id, {'myLabel': {'qos': 'rule.MyRule'}})255 client.login('manager')256 resp = client.delete('/v1/teams/{}/rules/{}'.format(team_id, rule_id))257 assert resp.status_code == 409258 assert resp.json == {259 'message': 'Rule MyRule is used in your configuration, please remove it before.'260 }261@pytest.mark.parametrize("test_input", ["'Test", "Test'", "'Test'", '"Test', 'Test"', '"Test"'])262def test_post_rule_prohibited_quotes(client, create_team, create_user, create_grant, test_input):263 team_id = str(create_team('My team')['id'])264 role = 'editor'265 user_id = str(create_user(role)['id'])266 create_grant(team_id, user_id, role)267 client.login(role)268 resp = client.post('/v1/teams/{}/rules'.format(team_id), data=json.dumps({'name': test_input}))269 assert resp.status_code == 400270@pytest.mark.parametrize("test_input", ["'Test", "Test'", "'Test'", '"Test', 'Test"', '"Test"'])271def test_put_rule_prohibited_quotes(client, create_team, create_user, create_grant, create_rule, test_input):272 team_id = str(create_team('My team')['id'])273 rule_id = str(create_rule('My rule', team_id)['id'])274 role = 'editor'275 user_id = str(create_user(role)['id'])276 create_grant(team_id, user_id, role)277 client.login(role)278 resp = client.put('/v1/teams/{}/rules/{}'.format(team_id, rule_id), data=json.dumps({'name': test_input}))...
test_sources.py
Source:test_sources.py
...34 resp = client.get('/v1/teams/{}/sources'.format(team_id))35 assert resp.status_code == 40336 for role in ['member', 'editor', 'manager']:37 user_id = str(create_user(role)['id'])38 create_grant(team_id, user_id, role)39 client.login(role)40 resp = client.get('/v1/teams/{}/sources'.format(team_id))41 assert resp.status_code == 20042def test_list_sources_notfound(client):43 client.login('depc')44 resp = client.get('/v1/teams/notfound/sources')45 assert resp.status_code == 40446def test_list_sources(client, create_team, create_user, create_grant, create_source, create_check):47 user_id = str(create_user('depc')['id'])48 team_id = str(create_team('My team')['id'])49 create_grant(team_id, user_id, 'member')50 client.login('depc')51 resp = client.get('/v1/teams/{}/sources'.format(team_id))52 assert resp.status_code == 20053 assert resp.json == {'sources': []}54 source_id = str(create_source('My source', team_id)['id'])55 resp = client.get('/v1/teams/{}/sources'.format(team_id))56 assert resp.status_code == 20057 assert resp.json == {58 'sources': [{59 'name': 'My source',60 'plugin': 'Fake',61 'checks': []62 }]63 }64 create_check('My check', source_id, 'Threshold', {'metric': 'foo', 'threshold': "100"})65 resp = client.get('/v1/teams/{}/sources'.format(team_id))66 assert resp.status_code == 20067 assert resp.json == {68 'sources': [{69 'name': 'My source',70 'plugin': 'Fake',71 'checks': [{72 'name': 'My check',73 'type': 'Threshold',74 'source_id': source_id,75 'parameters': {'metric': 'foo', 'threshold': "100"},76 }]77 }]78 }79 for i in range(9):80 create_source('Source {}'.format(i), team_id)81 resp = client.get('/v1/teams/{}/sources'.format(team_id))82 assert resp.status_code == 20083 assert len(resp.json['sources']) == 1084 # Manager can see the configuration85 user_id = str(create_user('manager')['id'])86 create_grant(team_id, user_id, 'manager')87 client.login('manager')88 resp = client.get('/v1/teams/{}/sources'.format(team_id))89 assert resp.status_code == 20090 assert 'configuration' in resp.json['sources'][0]91def test_get_source_authorization(client, create_team, create_source, create_user, create_grant):92 team_id = str(create_team('My team')['id'])93 source_id = str(create_source('My source', team_id)['id'])94 resp = client.get('/v1/teams/{}/sources/{}'.format(team_id, source_id))95 assert resp.status_code == 40196 client.login('depc')97 resp = client.get('/v1/teams/{}/sources/{}'.format(team_id, source_id))98 assert resp.status_code == 40399 for role in ['member', 'editor', 'manager']:100 user_id = str(create_user(role)['id'])101 create_grant(team_id, user_id, role)102 client.login(role)103 resp = client.get('/v1/teams/{}/sources/{}'.format(team_id, source_id))104 assert resp.status_code == 200105def test_get_team_source_notfound(client, create_team, create_user, create_grant):106 team_id = str(create_team('My team')['id'])107 user_id = str(create_user('depc')['id'])108 create_grant(team_id, user_id, 'member')109 client.login('depc')110 resp = client.get('/v1/teams/{}/sources/notfound'.format(team_id))111 assert resp.status_code == 404112def test_get_source(client, create_team, create_source, create_user, create_grant, create_check):113 user_id = str(create_user('depc')['id'])114 team_id = str(create_team('My team')['id'])115 create_grant(team_id, user_id, 'member')116 source_id = str(create_source('My source', team_id)['id'])117 client.login('depc')118 resp = client.get('/v1/teams/{}/sources/{}'.format(team_id, source_id))119 assert resp.status_code == 200120 assert resp.json == {121 'name': 'My source',122 'plugin': 'Fake',123 'checks': []124 }125 create_check('My check', source_id, 'Threshold', {'metric': 'foo', 'threshold': "100"})126 resp = client.get('/v1/teams/{}/sources/{}'.format(team_id, source_id))127 assert resp.status_code == 200128 assert resp.json == {129 'name': 'My source',130 'plugin': 'Fake',131 'checks': [{132 'name': 'My check',133 'type': 'Threshold',134 'source_id': source_id,135 'parameters': {'metric': 'foo', 'threshold': "100"}136 }]137 }138 # Manager can see the configuration139 user_id = str(create_user('manager')['id'])140 create_grant(team_id, user_id, 'manager')141 client.login('manager')142 resp = client.get('/v1/teams/{}/sources/{}'.format(team_id, source_id))143 assert resp.status_code == 200144 assert 'configuration' in resp.json145def test_post_source_authorization(client, create_team, create_user, create_grant):146 team_id = str(create_team('My team')['id'])147 post_data = {'name': 'My source', 'plugin': 'Fake', 'configuration': {}}148 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))149 assert resp.status_code == 401150 client.login('depc')151 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))152 assert resp.status_code == 403153 roles = {'member': 403, 'editor': 403, 'manager': 201}154 for role, status in roles.items():155 user_id = str(create_user(role)['id'])156 create_grant(team_id, user_id, role)157 client.login(role)158 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))159 assert resp.status_code == status160def test_post_source_notfound(client):161 post_data = {'name': 'My source', 'plugin': 'Fake', 'configuration': {}}162 client.login('depc')163 resp = client.post('/v1/teams/notfound/sources', data=json.dumps(post_data))164 assert resp.status_code == 404165def test_post_source(client, create_team, create_user, create_grant):166 user_id = str(create_user('depc')['id'])167 team_id = str(create_team('My team')['id'])168 create_grant(team_id, user_id, 'manager')169 client.login('depc')170 post_data = {'plugin': 'Fake', 'configuration': {}}171 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))172 assert resp.raises_required_property('name')173 post_data = {'name': 'My source', 'configuration': {}}174 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))175 assert resp.raises_required_property('plugin')176 post_data = {'name': 'My source', 'plugin': 'Fake'}177 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))178 assert resp.raises_required_property('configuration')179 post_data = {'name': 'My source', 'plugin': 'Fake', 'configuration': {}, 'additional': 'property'}180 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))181 assert resp.status_code == 400182 assert 'Additional properties are not allowed' in resp.json['message']183 post_data = {'name': 'My source', 'plugin': 'Fake', 'configuration': {}}184 resp = client.post('/v1/teams/{}/sources'.format(team_id), data=json.dumps(post_data))185 assert resp.status_code == 201186 assert resp.json == {187 'name': 'My source',188 'plugin': 'Fake',189 'configuration': {},190 'checks': []191 }192def test_put_source_authorization(client, create_team, create_source, create_user, create_grant):193 team_id = str(create_team('My team')['id'])194 source_id = str(create_source('My source', team_id)['id'])195 resp = client.put('/v1/teams/{}/sources/{}'.format(team_id, source_id), data=json.dumps({}))196 assert resp.status_code == 401197 client.login('depc')198 resp = client.put('/v1/teams/{}/sources/{}'.format(team_id, source_id), data=json.dumps({}))199 assert resp.status_code == 403200 roles = {'member': 403, 'editor': 403, 'manager': 200}201 for role, status in roles.items():202 user_id = str(create_user(role)['id'])203 create_grant(team_id, user_id, role)204 client.login(role)205 resp = client.put('/v1/teams/{}/sources/{}'.format(team_id, source_id), data=json.dumps({}))206 assert resp.status_code == status207def test_put_source_notfound(client, create_team, create_source, create_user, create_grant):208 team_id = str(create_team('My team')['id'])209 source_id = str(create_source('My source', team_id)['id'])210 user_id = str(create_user('manager')['id'])211 create_grant(team_id, user_id, 'manager')212 client.login('manager')213 resp = client.put('/v1/teams/notfound/sources/{}'.format(source_id), data=json.dumps({}))214 assert resp.status_code == 404215 resp = client.put('/v1/teams/{}/sources/notfound'.format(team_id), data=json.dumps({}))216 assert resp.status_code == 404217def test_put_source(client, create_team, create_source, create_user, create_grant):218 team_id = str(create_team('My team')['id'])219 source_id = str(create_source('My source', team_id)['id'])220 user_id = str(create_user('manager')['id'])221 create_grant(team_id, user_id, 'manager')222 client.login('manager')223 resp = client.put('/v1/teams/{}/sources/{}'.format(team_id, source_id), data=json.dumps({'additional': 'property'}))224 assert resp.status_code == 400225 assert 'Additional properties are not allowed' in resp.json['message']226 resp = client.put('/v1/teams/{}/sources/{}'.format(team_id, source_id), data=json.dumps({'name': 'My edited source'}))227 assert resp.status_code == 200228 assert resp.json == {229 'checks': [],230 'configuration': {},231 'name': 'My edited source',232 'plugin': 'Fake'233 }234def test_delete_source_authorization(client, create_team, create_source, create_user, create_grant):235 team_id = str(create_team('My team')['id'])236 source_id = str(create_source('My source', team_id)['id'])237 resp = client.delete('/v1/teams/{}/sources/{}'.format(team_id, source_id))238 assert resp.status_code == 401239 client.login('depc')240 resp = client.delete('/v1/teams/{}/sources/{}'.format(team_id, source_id))241 assert resp.status_code == 403242 roles = {'member': 403, 'editor': 403, 'manager': 200}243 for role, status in roles.items():244 user_id = str(create_user(role)['id'])245 create_grant(team_id, user_id, role)246 client.login(role)247 resp = client.delete('/v1/teams/{}/sources/{}'.format(team_id, source_id))248 assert resp.status_code == status249def test_delete_source_notfound(client, create_team, create_source, create_user, create_grant):250 team_id = str(create_team('My team')['id'])251 source_id = str(create_source('My source', team_id)['id'])252 user_id = str(create_user('manager')['id'])253 create_grant(team_id, user_id, 'manager')254 client.login('manager')255 resp = client.delete('/v1/teams/notfound/sources/{}'.format(source_id), data=json.dumps({}))256 assert resp.status_code == 404257 resp = client.put('/v1/teams/{}/sources/notfound'.format(team_id), data=json.dumps({}))258 assert resp.status_code == 404259def test_delete_source(client, create_team, create_source, create_user, create_grant):260 team_id = str(create_team('My team')['id'])261 source_id = str(create_source('My source', team_id)['id'])262 user_id = str(create_user('manager')['id'])263 create_grant(team_id, user_id, 'manager')264 client.login('manager')265 resp = client.delete('/v1/teams/{}/sources/{}'.format(team_id, source_id))266 assert resp.status_code == 200...
pre_iap_util_test.py
Source:pre_iap_util_test.py
...80 self.create_frequency_range(3550, 3700)),81 self.create_pal_record('PAL2',82 self.create_frequency_range(3550, 3600))83 ])84 def create_grant(self, low_freq, high_freq):85 return {86 'operationParam': {87 'operationFrequencyRange':88 self.create_frequency_range(low_freq, high_freq)89 }90 }91 def test_frequency_overlap(self):92 # Partial overlap, grant starts inside of the |frequency_range|.93 self.assertTrue(94 pre_iap_util.checkForOverlappingGrants(95 self.create_grant(3680, 3690),96 self.create_frequency_range(3650, 3700)))97 # Partial overlap, grant ends inside of the |frequency_range|.98 self.assertTrue(99 pre_iap_util.checkForOverlappingGrants(100 self.create_grant(3600, 3660),101 self.create_frequency_range(3650, 3700)))102 # Grant's frequency range inside the |frequency_range|.103 self.assertTrue(104 pre_iap_util.checkForOverlappingGrants(105 self.create_grant(3660, 3680),106 self.create_frequency_range(3650, 3700)))107 # The |frequency_range| inside the grant's frequency range.108 self.assertTrue(109 pre_iap_util.checkForOverlappingGrants(110 self.create_grant(3660, 3680),111 self.create_frequency_range(3650, 3700)))112 # No overlap113 self.assertFalse(114 pre_iap_util.checkForOverlappingGrants(115 self.create_grant(3600, 3640),116 self.create_frequency_range(3650, 3700)))117 self.assertFalse(118 pre_iap_util.checkForOverlappingGrants(119 self.create_grant(3660, 3700),120 self.create_frequency_range(3600, 3650)))121 # Adjacant do not overlap122 self.assertFalse(123 pre_iap_util.checkForOverlappingGrants(124 self.create_grant(3600, 3650),125 self.create_frequency_range(3650, 3700)))126 self.assertFalse(127 pre_iap_util.checkForOverlappingGrants(128 self.create_grant(3660, 3700),129 self.create_frequency_range(3600, 3660)))130if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!