def test_case(self): try: self.assertEqual(["i1", "i2", "i3", "i4", "i5"], handler.Handle({}, Context())) os.environ["AWS_ACCESS_KEY_ID"] = "h1" os.environ["AWS_SECRET_ACCESS_KEY"] = "h2" os.environ["AWS_SESSION_TOKEN"] = "h3" os.environ["AWS_SECURITY_TOKEN"] = "h4" os.environ["_X_AMZN_TRACE_ID"] = "h5" self.assertEqual(["h1", "h2", "h3", "h4", "h5"], handler.Handle({}, Context())) except Exception: self.fail("should not raise")
def test_case(self): try: handler.Handle({}, Context()) except Exception as e: self.assertEqual("CustomError", type(e).__name__) return self.fail("should raise")
def test_case(self): with self.assertRaisesRegexp(Exception, "something bad happened"): handler.Handle({}, Context())
def test_case(self): with self.assertRaisesRegexp( AttributeError, "runtime: symbol Handle is not a function"): handler.Handle({}, Context())
def test_case(self): try: handler.Handle({}, Context) except: self.fail("should not raise")
def test_case(self): evt = { "Foo": "Bar" } self.assertDictEqual(evt, handler.Handle(evt, Context()))
def test_case(self): os.environ["FOO"] = "BAR" self.assertEqual("BAR", handler.Handle({}, Context())) os.environ["FOO"] = "BAZ" self.assertEqual("BAZ", handler.Handle({}, Context()))
def test_case(self): self.assertEqual(4200, handler.Handle({}, Context()))
def test_case(self): ctx = Context() handler.Handle({}, ctx) self.assertEqual(200, len(ctx.logs))