How to use test_update_endpoint method in tempest

Best Python code snippet using tempest_python

test_utils.py

Source:test_utils.py Github

copy

Full Screen

1###############################################2# Authors: Markus Hofmeister (mh807cam.ac.uk) # 3# Date: 01 Apr 2022 #4###############################################5import os6import pytest7# Import module under test from gasgridagent8import metoffice.utils.properties as utils9def test_read_properties_file(tmp_path):10 # Create empty test properties file11 p = os.path.join(tmp_path, "test_metoffice.properties")12 # Test for MetOffice 'api.key'13 # 1) Exception for missing key14 with pytest.raises(KeyError) as excinfo:15 # Check correct exception type16 utils.read_properties_file(p)17 # Check correct exception message18 expected = 'Key "api.key" is missing in properties file: '19 assert expected in str(excinfo.value)20 # 2) Exception for available key, but missing value21 with open(p, 'w') as f:22 f.write("api.key = ")23 with pytest.raises(KeyError) as excinfo:24 # Check correct exception type25 utils.read_properties_file(p)26 # Check correct exception message27 expected = 'No "api.key" value has been provided in properties file: '28 assert expected in str(excinfo.value)29 # Test for TimeSeriesClient (PostgreSQL DB) 'db.url'30 with open(p, 'w') as f:31 f.write("api.key = test_key\n")32 with pytest.raises(KeyError) as excinfo:33 utils.read_properties_file(p)34 expected = 'Key "db.url" is missing in properties file: '35 assert expected in str(excinfo.value)36 with open(p, 'a') as f:37 f.write("db.url = ")38 with pytest.raises(KeyError) as excinfo:39 utils.read_properties_file(p)40 expected = 'No "db.url" value has been provided in properties file: '41 assert expected in str(excinfo.value)42 # Test for TimeSeriesClient (PostgreSQL DB) 'db.user'43 with open(p, 'w') as f:44 f.write("api.key = test_key\n\45 db.url = test_url\n")46 with pytest.raises(KeyError) as excinfo:47 utils.read_properties_file(p)48 expected = 'Key "db.user" is missing in properties file: '49 assert expected in str(excinfo.value)50 with open(p, 'a') as f:51 f.write("db.user = ")52 with pytest.raises(KeyError) as excinfo:53 utils.read_properties_file(p)54 expected = 'No "db.user" value has been provided in properties file: '55 assert expected in str(excinfo.value)56 # Test for TimeSeriesClient (PostgreSQL DB) 'db.password'57 with open(p, 'w') as f:58 f.write("api.key = test_key\n\59 db.url = test_url\n\60 db.user = test_user\n")61 with pytest.raises(KeyError) as excinfo:62 utils.read_properties_file(p)63 expected = 'Key "db.password" is missing in properties file: '64 assert expected in str(excinfo.value)65 with open(p, 'a') as f:66 f.write("db.password = ")67 with pytest.raises(KeyError) as excinfo:68 utils.read_properties_file(p)69 expected = 'No "db.password" value has been provided in properties file: '70 assert expected in str(excinfo.value)71 # Test for 'sparql.query.endpoint'72 with open(p, 'w') as f:73 f.write("api.key = test_key\n\74 db.url = test_url\n\75 db.user = test_user\n\76 db.password = test_password\n")77 with pytest.raises(KeyError) as excinfo:78 utils.read_properties_file(p)79 expected = 'Key "sparql.query.endpoint" is missing in properties file: '80 assert expected in str(excinfo.value)81 with open(p, 'a') as f:82 f.write("sparql.query.endpoint = ")83 with pytest.raises(KeyError) as excinfo:84 utils.read_properties_file(p)85 expected = 'No "sparql.query.endpoint" value has been provided in properties file: '86 assert expected in str(excinfo.value)87 # Test for 'sparql.update.endpoint'88 with open(p, 'w') as f:89 f.write("api.key = test_key\n\90 db.url = test_url\n\91 db.user = test_user\n\92 db.password = test_password\n\93 sparql.query.endpoint = test_query_endpoint\n")94 with pytest.raises(KeyError) as excinfo:95 utils.read_properties_file(p)96 expected = 'Key "sparql.update.endpoint" is missing in properties file: '97 assert expected in str(excinfo.value)98 with open(p, 'a') as f:99 f.write("sparql.update.endpoint = ")100 with pytest.raises(KeyError) as excinfo:101 utils.read_properties_file(p)102 expected = 'No "sparql.update.endpoint" value has been provided in properties file: '103 assert expected in str(excinfo.value)104 # Test correct reading of timeseries.properties file105 with open(p, 'w') as f:106 f.write("api.key = test_key\n\107 db.url = test_url\n\108 db.user = test_user\n\109 db.password = test_password\n\110 sparql.query.endpoint = test_query_endpoint\n\111 sparql.update.endpoint = test_update_endpoint")112 utils.read_properties_file(p)113 assert utils.DATAPOINT_API_KEY == 'test_key'114 assert utils.DB_URL == 'test_url'115 assert utils.DB_USER == 'test_user'116 assert utils.DB_PASSWORD == 'test_password'117 assert utils.QUERY_ENDPOINT == 'test_query_endpoint'...

Full Screen

Full Screen

view.py

Source:view.py Github

copy

Full Screen

...113 def test_filter_endpoints(self):114 self.get('/v1.0/ncs/endpoints', query={'service': 'auth', 'catalog': 'beehive'})115 def test_get_endpoint(self):116 self.get('/v1.0/ncs/endpoints/{oid}', params={'oid': 'endpoint-prova'})117 def test_update_endpoint(self):118 data = {119 'endpoint': {120 'name': 'endpoint-prova',121 'desc': 'Authorization endpoint 02',122 'service': 'auth',123 'uri': 'http://localhost:6060/v1.0/auth/',124 'active': True125 }126 }127 self.put('/v1.0/ncs/endpoints/{oid}', params={'oid': 'endpoint-prova'}, data=data)128 def test_delete_endpoint(self):129 self.delete('/v1.0/ncs/endpoints/{oid}', params={'oid': 'endpoint-prova'})130tests = []131for test_plans in [...

Full Screen

Full Screen

tests.py

Source:tests.py Github

copy

Full Screen

...27 self.assertGreater(len(models.%s.objects.all()), 1)28 29 30 @parameterized.expand([updated_data, obj, client])31 def test_update_endpoint(self, updated_data: dict, obj, client):32 response = client.put('http://localhost:8000/%s/', timeout=10) 33 self.assertEquals(response.status_code, 200)34 35 36 @parameterized.expand([obj_id, client])37 def test_delete_endpoint(self, client):38 response = client.delete('http://localhost:8000/%s/', timeout=10) 39 self.assertEquals(response.status_code, 200)40 self.assertLess(len(models.%s.objects.all()), 1)41 42 """ % (model, model.lower(), model, model, model, model)43 )44 assert result_output.stdout.files[-4:-2] == [45 u'test_endpoints.py::test_create_endpoint PASSED',...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful