Exemplo n.º 1
0
 def setUp(self):
     self.env_file_path = 'tests/fixtures/.env'
     self.env = Environment(env_file=self.env_file_path)
     with open(self.env_file_path, 'w') as envfile:
         envfile.write(env_content)
     self.env.set_environment()
     self.settings = self.env.get_app_settings()
Exemplo n.º 2
0
class EnvironmentBaseTest(unittest.TestCase):

    def setUp(self):
        self.env_file_path = 'tests/fixtures/.env'
        self.env = Environment(env_file=self.env_file_path)
        with open(self.env_file_path, 'w') as envfile:
            envfile.write(env_content)
        self.env.set_environment()
        self.settings = self.env.get_app_settings()

    def tearDown(self):
        os.environ['APP_ENV'] = ''
        os.environ['APP_ROOT'] = ''
        os.environ['NONEXISTENT_SETTING'] = ''
        os.environ['EXISTENT_SETTING'] = ''
        os.environ['TEST_VARS'] = ''
Exemplo n.º 3
0
parser.add_argument('env', type=str, action='store', help='the environment')
parser.add_argument('--h', action='store_true', help='if set, usage will be printed out')
args = parser.parse_args()

## TODO error checking on the args

if args.h:
    parser.print_help()

print()

#===============================================================================
# Connecting to MongoDB
#===============================================================================

env = Environment(args.env)
connect(
	db=env.DB_NAME,
	username=env.DB_USERNAME,
	password=env.DB_PASSWORD,
	host='mongodb://' + env.DB_HOST
)

## Add bitcoin as a coin of interest
btn = "BTC"
btc_coin = Coin.objects(ticker=btn)
if btc_coin.count() == 0:
	print('adding BTC')
	Coin(ticker=btn,name="Bitcoin",validation_method="Pow",hashing_algorithm="sha256").save()

eth = "ETH"