def test_disable_accounts(self):
        """Test disabling an account in a session."""
        with custom_qiskitrc(), mock_ibmq_provider():
            IBMQ.enable_account('QISKITRC_TOKEN')
            IBMQ.disable_accounts(token='QISKITRC_TOKEN')

            self.assertEqual(len(IBMQ._accounts), 0)
 def test_disable_all_accounts(self):
     """Test disabling all accounts from session."""
     with custom_qiskitrc(), mock_ibmq_provider():
         IBMQ.enable_account('QISKITRC_TOKEN')
         IBMQ.enable_account('QISKITRC_TOKEN',
                             url=IBMQ_TEMPLATE.format('a', 'b', 'c'))
         IBMQ.disable_accounts()
         self.assertEqual(len(IBMQ._accounts), 0)
            job_sim = execute(qc, backend_sim)  # default is 1024 shots
            result_sim = job_sim.result()
            counts_sim = result_sim.get_counts(qc)
            counts = "".join(json.dumps(counts_sim).split("\"")[1].split(" "))

            # Compare output counts
            benchmark_file = benchmarks_filepath + "/" + file_base + "/" + file_base + ".counts"
            counts_file = open(benchmark_file, "r")
            benchmark_measurement = counts_file.readline()
            print(counts)
            if counts == benchmark_measurement:
                print('\033[92m' + "  passed" + '\033[0m' + '\n')
                correct_tests = correct_tests + 1
            else:
                print('\033[91m' + " failed - " + str(counts) +
                      " measurement is not " + benchmark_measurement +
                      '\033[0m' + '\n')
            total_tests = total_tests + 1
            os.remove(generated_qasm)

print("\n===================================")
if (correct_tests == total_tests):
    print('\033[92m' + str(correct_tests) + "/" + str(total_tests) +
          " tests passed" + '\033[0m')
else:
    print('\033[91m' + str(correct_tests) + "/" + str(total_tests) +
          " tests passed" + '\033[0m')

if using_config_account:
    IBMQ.disable_accounts(token=IBMQ_token)