def test_sign_filename_returns_signature(self): with my_vcr.use_cassette('sign_one') as cassette: result = self.instance.sign(filename=fixture_path('one.pdf')) self.assertEqual(1, len(cassette)) self.assertIsInstance(result, Signature) self.assertIsInstance(result.contents, bytes)
def test_sign_batch(self): pdfs = [PDF(fixture_path(filename)) for filename in ["one.pdf", "two.pdf", "three.pdf"]] with my_vcr.use_cassette('sign_batch'): self.instance.sign_batch(pdfs) from pprint import pprint as pp pp([p.out_filename for p in pdfs])
def test_wrong_customer_authentication_failed(self): bad_instance = AIS(customer="wrong_name", key_static="wrong_key", cert_file=self.cert_file, cert_key=self.cert_key) with self.assertRaises(AuthenticationFailed): with my_vcr.use_cassette('wrong_customer'): bad_instance.sign_one_pdf(PDF(fixture_path('one.pdf')))
def test_sign_single_unprepared_pdf(self): self.assertIsNone(self.instance.last_request_id) pdf = PDF(fixture_path('one.pdf')) with my_vcr.use_cassette('sign_unprepared_pdf'): self.instance.sign_one_pdf(pdf) self.assertIsNotNone(self.instance.last_request_id)
def test_sign_batch(self): pdfs = [ PDF(fixture_path(filename)) for filename in ["one.pdf", "two.pdf", "three.pdf"] ] with my_vcr.use_cassette('sign_batch'): self.instance.sign_batch(pdfs) from pprint import pprint as pp pp([p.out_filename for p in pdfs])
def test_sign_batch(self): self.assertIsNone(self.instance.last_request_id) pdfs = [PDF(fixture_path(filename)) for filename in ["one.pdf", "two.pdf", "three.pdf"]] with my_vcr.use_cassette('sign_batch'): self.instance.sign_batch(pdfs) self.assertIsNotNone(self.instance.last_request_id)
def test_sign_single_unprepared_pdf(self): pdf = PDF(fixture_path('one.pdf')) with my_vcr.use_cassette('sign_unprepared_pdf'): self.instance.sign_one_pdf(pdf)
def test_sign_single_prepared_pdf(self): pdf = PDF(fixture_path('prepared.pdf'), prepared=True) with my_vcr.use_cassette('sign_prepared_pdf'): self.instance.sign_one_pdf(pdf)