<commit_before>const _ = require('lodash');
import models from '../server/models';

const testStripeAccounts = {
  'opensource': {
    service: 'stripe',
    username: 'acct_18KWlTLzdXg9xKNS',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 83
  },
  // Open Collective Inc. host for meetups
  'other': {
    service: 'stripe',
    username: 'acct_18KWlTLzdXg9xKNS',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 8674
  },
  'brussesltogether': {
    service: 'stripe',
    username: 'acct_198T7jD8MNtzsDcg',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 207
  },
  'wwcode': {
    service: 'stripe',
    username: 'acct_xxxxxxxxxxxxxxxx',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 51
  }
}

const done = (err) => {
  if (err) console.log('err', err);
  console.log('done!');
  process.exit();
}

const createConnectedAccount = (hostname) => {
  return models.ConnectedAccount
    .create(testStripeAccounts[hostname])
    .catch(e => {
      // will fail if the host is not present (e.g. when migrating wwcode_test)
      console.log(`[warning] Unable to create a connected account for ${hostname}`);
      if (process.env.DEBUG) {
        console.error(e);
      }
    });
}

models.ConnectedAccount.destroy({ where: { service: 'stripe' }, force: true})
.then(() => createConnectedAccount('opensource'))
.then(() => createConnectedAccount('brussesltogether'))
.then(() => createConnectedAccount('wwcode'))
.then(() => done())
.catch(done)<commit_msg>keep test stripe account for the other host<commit_after>const _ = require('lodash');
import models from '../server/models';

const testStripeAccounts = {
  'opensource': {
    service: 'stripe',
    username: 'acct_18KWlTLzdXg9xKNS',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 83
  },
  // Open Collective Inc. host for meetups
  'other': {
    service: 'stripe',
    username: 'acct_18KWlTLzdXg9xKNS',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 8674
  },
  'brussesltogether': {
    service: 'stripe',
    username: 'acct_198T7jD8MNtzsDcg',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 207
  },
  'wwcode': {
    service: 'stripe',
    username: 'acct_xxxxxxxxxxxxxxxx',
    token: '<KEY>',
    data: {
      publishableKey: '<KEY>'
    },
    CollectiveId: 51
  }
}

const done = (err) => {
  if (err) console.log('err', err);
  console.log('done!');
  process.exit();
}

const createConnectedAccount = (hostname) => {
  return models.ConnectedAccount
    .create(testStripeAccounts[hostname])
    .catch(e => {
      // will fail if the host is not present (e.g. when migrating wwcode_test)
      console.log(`[warning] Unable to create a connected account for ${hostname}`);
      if (process.env.DEBUG) {
        console.error(e);
      }
    });
}

models.ConnectedAccount.destroy({ where: { service: 'stripe' }, force: true})
.then(() => createConnectedAccount('opensource'))
.then(() => createConnectedAccount('other'))
.then(() => createConnectedAccount('brussesltogether'))
.then(() => createConnectedAccount('wwcode'))
.then(() => done())
.catch(done)
{'fraction_non_alphanumeric': 0.16943521594684385, 'fraction_numerical': 0.013289036544850499, 'mean_word_length': 3.290155440414508, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4111386', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1146, 'n_words': 242}