Esempio n. 1
0
 def test_5_service_storage(self):
     test_common.setup_test_vault(self.did)
     count_vault_storage_job()
     r, msg = can_access_vault(self.did, VAULT_ACCESS_WR)
     self.assertTrue(r)
     inc_vault_file_use_storage_byte(self.did, 55000000)
     update_vault_db_use_storage_byte(self.did, 55000000)
     r, msg = can_access_vault(self.did, VAULT_ACCESS_WR)
     self.assertFalse(r)
     inc_vault_file_use_storage_byte(self.did, -20000000)
     update_vault_db_use_storage_byte(self.did, 30000000)
     r, msg = can_access_vault(self.did, VAULT_ACCESS_WR)
     self.assertTrue(r)
    def setUp(self):
        logging.getLogger("HiveMongoScriptingTestCase").info("\n")
        self.app = create_app(mode=HIVE_MODE_TEST)
        self.app.config['TESTING'] = True
        self.test_client = self.app.test_client()
        self.content_type = ("Content-Type", "application/json")

        self.json_header = [
            self.content_type,
        ]
        test_common.setup_test_auth_token()
        self.init_auth()
        self.did = test_common.get_auth_did()
        self.app_id = test_common.get_auth_app_did()
        test_common.setup_test_vault(self.did)
        self.init_collection_for_test()
    def setUp(self):
        logging.getLogger("HiveFileTestCase").info("\n")
        self.app = create_app(mode=HIVE_MODE_TEST)
        self.app.config['TESTING'] = True
        self.test_client = self.app.test_client()
        self.content_type = ("Content-Type", "application/json")
        self.upload_file_content_type = ("Content-Type", "multipart/form-data")

        self.json_header = [
            self.content_type,
        ]
        test_common.setup_test_auth_token()
        self.init_auth()
        self.did = test_common.get_auth_did()
        self.app_id = test_common.get_auth_app_did()
        test_common.setup_test_vault(self.did)
        self.clear_all_test_files()
Esempio n. 4
0
 def test_6_service_management_timeout_ONLY_READ(self):
     test_common.remove_test_vault(self.did)
     self.assert_service_vault_info(None)
     test_common.setup_test_vault(self.did)
     now = datetime.utcnow().timestamp()
     self.change_service(now - 24 * 60 * 60, now - 1, 5000, "Rookie")
     count_vault_storage_job()
     self.assert_service_vault_info("Rookie")
     inc_vault_file_use_storage_byte(self.did, 910000000)
     update_vault_db_use_storage_byte(self.did, 910000000)
     r, msg = can_access_vault(self.did, VAULT_ACCESS_WR)
     self.assertTrue(r)
     proc_expire_vault_job()
     self.assert_service_vault_info("Free")
     r, msg = can_access_vault(self.did, VAULT_ACCESS_R)
     self.assertTrue(r)
     r, msg = can_access_vault(self.did, VAULT_ACCESS_WR)
     self.assertFalse(r)