How to use test_create_tag method in localstack

Best Python code snippet using localstack_python

orm.py

Source:orm.py Github

copy

Full Screen

...11 Base.metadata.create_all(bind=self.engine)12 self.session = Session()13 def tearDown(self) -> None:14 self.session.close()15 def test_create_tag(self):16 tag = create_tag(self.session, 'teste')17 print(tag)18 self.assertEqual(tag.name, 'teste')19 return tag20 def test_create_insight_with_new_tag(self):21 new_insight = NewInsight(texto='teste de insight', tags=['teste'])22 insight = create_insight(self.session, new_insight)23 print(insight)24 self.assertEqual(insight.texto, 'teste de insight')25 return insight26 def test_list_all_insight(self):27 insight = self.test_create_insight_with_new_tag()28 insights = list_cards(self.session)29 print(insights)30 self.assertListEqual(insights, [insight])31 def test_delete_insight(self):32 tag = self.test_create_tag()33 insight = self.test_create_insight_with_new_tag()34 delete_insight(self.session, insight.id)35 insights = list_cards(self.session)36 print(insights)37 self.session.refresh(tag)38 self.assertListEqual(insights, [])39 self.assertListEqual(tag.insights, [])40 def test_create_insight_with_old_tag(self):41 tag = self.test_create_tag()42 insight = self.test_create_insight_with_new_tag()43 print(tag, insight, sep='\n')44 self.assertEqual(insight.tags[0], tag)45 return insight46 def test_update_tag_ok(self):47 tag = self.test_create_tag()48 new_tag = update_tag(self.session, tag.id, Tag(name='teste2'))49 print(new_tag)50 self.assertEqual(new_tag.name, 'teste2')51 def test_update_tag_nok(self):52 tag = self.test_create_tag()53 with self.assertRaises(ValueError):54 new_tag = update_tag(self.session, tag.id, Tag(name=tag.name))55 print(new_tag)56 def test_update_insight_ok(self):57 insight = self.test_create_insight_with_new_tag()58 new_insight = update_insight(self.session, insight.id, NewInsight(texto='Teste 2 de insight', tags=['teste2']))59 print(new_insight)60 self.assertEqual(insight.id, new_insight.id)61 self.assertEqual(insight.texto, 'Teste 2 de insight')62 self.assertEqual(len(insight.tags), 1)63 self.assertEqual(insight.tags[0].name, 'teste2')64 def test_update_insight_nok(self):65 insight = self.test_create_insight_with_new_tag()66 with self.assertRaises(ValueError):67 new_insight = update_insight(self.session, insight.id, NewInsight(texto=insight.texto, tags=insight.tags))68 print(new_insight)69 def test_delete_tag(self):70 tag = self.test_create_tag()71 insight = self.test_create_insight_with_new_tag()72 delete_tag(self.session, tag.id)73 self.session.refresh(insight)74 print(insight)75 self.assertListEqual(insight.tags, [])76 def test_list_insights(self):77 trash = [78 create_insight(self.session, NewInsight(texto=f'Teste {i}', tags=[f'teste{k}' for k in range(j)]))79 for i in range(3)80 for j in range(3)81 ]82 test_insights = [83 create_insight(self.session, NewInsight(texto=f'Teste {i}', tags=['teste3'])) for i in range(5)84 ]...

Full Screen

Full Screen

test_image_tags_resource.py

Source:test_image_tags_resource.py Github

copy

Full Screen

...21 def setUp(self):22 super(TestImageTagsController, self).setUp()23 self.db = unit_test_utils.FakeDB()24 self.controller = glance.api.v2.image_tags.Controller(self.db)25 def test_create_tag(self):26 request = unit_test_utils.get_fake_request()27 self.controller.update(request, unit_test_utils.UUID1, 'dink')28 context = request.context29 tags = self.db.image_tag_get_all(context, unit_test_utils.UUID1)30 self.assertEqual(1, len([tag for tag in tags if tag == 'dink']))31 def test_create_duplicate_tag_ignored(self):32 request = unit_test_utils.get_fake_request()33 self.controller.update(request, unit_test_utils.UUID1, 'dink')34 self.controller.update(request, unit_test_utils.UUID1, 'dink')35 context = request.context36 tags = self.db.image_tag_get_all(context, unit_test_utils.UUID1)37 self.assertEqual(1, len([tag for tag in tags if tag == 'dink']))38 def test_delete_tag(self):39 request = unit_test_utils.get_fake_request()40 self.controller.delete(request, unit_test_utils.UUID1, 'ping')41 def test_delete_tag_not_found(self):42 request = unit_test_utils.get_fake_request()43 self.assertRaises(webob.exc.HTTPNotFound, self.controller.delete,44 request, unit_test_utils.UUID1, 'what')45class TestImagesSerializer(test_utils.BaseTestCase):46 def setUp(self):47 super(TestImagesSerializer, self).setUp()48 self.serializer = glance.api.v2.image_tags.ResponseSerializer()49 def test_create_tag(self):50 response = webob.Response()51 self.serializer.update(response, None)52 self.assertEqual(204, response.status_int)53 def test_delete_tag(self):54 response = webob.Response()55 self.serializer.delete(response, None)...

Full Screen

Full Screen

test_tag.py

Source:test_tag.py Github

copy

Full Screen

2"""3公司测试用例4"""5class TestTag:6 def test_create_tag(self):7 print("[TestTag] ===== test_create_tag >>> 测试了创建Tag, token 为[%s]" % global_value.TOKEN)...

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 localstack 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