<s> from __future__ import unicode_literals <EOL> import shutil <EOL> from django . test import TestCase <EOL> from . . api import GPG , Key <EOL> from . . settings import setting_gpg_path <EOL> from . literals import TEST_GPG_HOME , TEST_KEY_ID , TEST_KEYSERVERS , TEST_UIDS <EOL> class DjangoGPGTestCase ( TestCase ) : <EOL> def setUp ( self ) : <EOL> try : <EOL> shutil . rmtree ( TEST_GPG_HOME ) <EOL> except OSError : <EOL> pass <EOL> self . gpg = GPG ( <EOL> binary_path = setting_gpg_path . value , home = TEST_GPG_HOME , <EOL> keyservers = TEST_KEYSERVERS <EOL> ) <EOL> def test_main ( self ) : <EOL> self . assertEqual ( Key . get_all ( self . gpg , secret = True ) , [ ] ) <EOL> self . assertEqual ( Key . get_all ( self . gpg ) , [ ] ) <EOL> self . assertTrue ( <EOL> TEST_KEY_ID in [ <EOL> key_stub . key_id for key_stub in self . gpg . query ( TEST_UIDS ) <EOL> ] <EOL> ) <EOL> self . gpg . receive_key ( key_id = TEST_KEY_ID [ - <NUM_LIT:8> : ] ) <EOL> self . assertTrue ( <EOL> TEST_KEY_ID [ - <NUM_LIT:16> : ] in [ <EOL> key_stub . key_id for key_stub in Key . get_all ( self . gpg ) <EOL> ] <EOL> ) </s>
