def setUpClass(cls): super(TestSuperAdminViewsWithData, cls).setUpClass() # Init User cls.user_name = 'test_super_admin1' cls.password = '******' cls.address = 'test_address_111111111' cls.public_key = 'test_publickey' cls.enc_master_seed = 'test_enc_master_seed' cls.enc_master_key = 'test_enc_master_key' # Transaction cls.from_address = cls.address cls.to_address = cls.address cls.amount = 10000000 cls.sequence = 20 cls.ledger = 12345678 cls.created = datetime.datetime.now() cls.destination_tag = 11111111 cls.status = 'test_status' cls.txid = 'dcsac89dsachd98ahc98adh' cls.path = reverse('admin_panel:login_page') cls.client = Client() # Common DB cls.cm_db = util.get_db_connect() # Create User enc_password = util.encrypt_password(cls.password) cls.test_user = Login_Master.objects.create(user_name=cls.user_name, password=enc_password) # Sample data insert_sample_address(cls.user_name,cls.address,cls.public_key,cls.enc_master_seed,cls.enc_master_key) insert_sample_transaction(cls.from_address, cls.to_address, cls.amount, cls.txid, cls.sequence,cls.ledger,cls.destination_tag,cls.status)
def setUpClass(cls): super(TestPanelUsersAdmin, cls).setUpClass() cls.user_name = 'test_admin_1' cls.panel_user_name = 'test_admin_1' cls.password = '******' cls.address = 'test_address' cls.public_key = 'test_public_key' cls.enc_master_seed = 'test_enc_master_seed' cls.enc_master_key = 'test_enc_master_key' cls.from_address = cls.address cls.to_address = cls.address cls.amount = 100000 cls.txid = 'asdacsacaw23f43c23' cls.sequence = 13548921 cls.ledger = 123456 cls.destination_tag = 00025415 cls.status = 'success' cls.role = 'admin' cls.token = 'test_token' cls.url = 'test_url' cls.app_key = 'test_app_key' cls.app_secret = 'test_app_secret' enc_password = util.encrypt_password(cls.password) cls.test_user = Panel_Master.objects.create(application_user=cls.user_name,panel_user_name=cls.panel_user_name, password=enc_password,role=cls.role) insert_sample_user(cls.user_name,cls.token,cls.url,cls.app_key,cls.app_secret) cls.login_path = reverse('admin_panel:login_page') cls.client = Client()
def setUpClass(cls): super(TestPanelAdminUnauthenticAccessFromManager, cls).setUpClass() # Init User cls.panel_user_name = 'test_admin_3' cls.password = '******' cls.login_path = reverse('admin_panel:login_page') # Create User enc_password = util.encrypt_password(cls.password) cls.test_user = Panel_Master.objects.create(panel_user_name=cls.panel_user_name, password=enc_password,role='manager')
def setUpClass(cls): super(TestLoginView, cls).setUpClass() # Init User cls.user_name = 'test_login_1' cls.password = '******' cls.login_path = reverse('admin_panel:login_page') # Create User enc_password = util.encrypt_password(cls.password) cls.test_user = Panel_Master.objects.create(panel_user_name=cls.user_name, password=enc_password, role='admin')
def setUpClass(cls): super(TestSuperAdminUnauthenticAccess, cls).setUpClass() # Init User cls.user_name = 'test_super_admin2' cls.password = '******' cls.path = reverse('admin_panel:login_page') # Create User enc_password = util.encrypt_password(cls.password) cls.test_user = Login_Master.objects.create(user_name=cls.user_name, password=enc_password)
def setUpClass(cls): super(TestPanelUsersAdminUnauthenticAccess, cls).setUpClass() cls.user_name = '' cls.panel_user_name = 'test_admin_2' cls.password = '******' cls.role = 'admin' enc_password = util.encrypt_password(cls.password) cls.test_user = Panel_Master.objects.create(application_user=cls.user_name, panel_user_name=cls.panel_user_name, password=enc_password, role=cls.role) cls.login_path = reverse('admin_panel:login_page') cls.client = Client()
def test_encryption(): test_password = '******' enc_pass = util.encrypt_password(test_password) dec_sk = util.decrypt_password(password=test_password, enc_pass=enc_pass) assert dec_sk == test_password