From dce42878877f29ebd039b32a2a79849a81326c67 Mon Sep 17 00:00:00 2001 From: Anton-Ivanov Date: Wed, 10 Jul 2024 23:29:23 +0300 Subject: [PATCH 1/4] rename file name of factories to be annotated by annotate gem --- spec/factories/{account.rb => accounts.rb} | 38 +++ spec/factories/admin_user.rb | 19 -- spec/factories/admin_users.rb | 50 +++ .../audit_log_item.rb => audit_log_items.rb} | 18 +- spec/factories/auth_log.rb | 40 --- spec/factories/background_tasks.rb | 32 ++ spec/factories/batch_update_form/account.rb | 0 spec/factories/billing/contact.rb | 14 - spec/factories/billing/contacts.rb | 35 ++ spec/factories/billing/invoice_template.rb | 8 - spec/factories/billing/invoice_templates.rb | 23 ++ spec/factories/billing/package_counter.rb | 11 - spec/factories/billing/package_counters.rb | 32 ++ spec/factories/cdr/auth_logs.rb | 83 +++++ spec/factories/cdr/cdr.rb | 64 ---- spec/factories/cdr/cdr_export.rb | 28 -- spec/factories/cdr/cdrs.rb | 220 +++++++++++++ spec/factories/cdr_exports.rb | 53 +++ spec/factories/cnam/database_https.rb | 16 + spec/factories/cnam/databases.rb | 27 ++ .../{codec_group.rb => codec_groups.rb} | 11 + spec/factories/contractor.rb | 20 -- spec/factories/contractors.rb | 44 +++ spec/factories/customers_auth.rb | 67 ---- spec/factories/customers_auths.rb | 170 ++++++++++ spec/factories/dialpeer.rb | 39 --- spec/factories/dialpeer_next_rate.rb | 23 -- spec/factories/dialpeer_next_rates.rb | 48 +++ spec/factories/dialpeers.rb | 103 ++++++ ...disconnect_code.rb => disconnect_codes.rb} | 2 +- spec/factories/equipment/cnam_database.rb | 10 - .../factories/equipment/cnam_database_http.rb | 8 - .../equipment/radius/accounting_profile.rb | 21 -- ...=> accounting_profile_start_attributes.rb} | 18 +- ... => accounting_profile_stop_attributes.rb} | 18 +- .../equipment/radius/accounting_profiles.rb | 41 +++ .../equipment/radius/auth_profile.rb | 18 -- .../equipment/radius/auth_profiles.rb | 35 ++ spec/factories/equipment/registrations.rb | 55 ++++ .../signing_certificates.rb} | 11 + .../trusted_certificates.rb} | 9 + .../stir_shaken/trusted_repositories.rb | 18 ++ .../stir_shaken_trusted_repository.rb | 9 - spec/factories/{log/event.rb => events.rb} | 14 +- spec/factories/gateway.rb | 139 -------- spec/factories/gateway_group.rb | 9 - spec/factories/gateway_groups.rb | 29 ++ spec/factories/gateways.rb | 304 ++++++++++++++++++ spec/factories/gateways_stat.rb | 31 -- spec/factories/gateways_stats.rb | 34 ++ spec/factories/importing/accounts.rb | 45 +++ spec/factories/importing/contractors.rb | 35 ++ spec/factories/importing/customers_auths.rb | 152 +++++++++ spec/factories/importing/destinations.rb | 79 +++++ spec/factories/importing/dialpeers.rb | 110 +++++++ .../importing/disconnect_policies.rb | 19 ++ spec/factories/importing/gateway_groups.rb | 27 ++ spec/factories/importing/gateways.rb | 255 +++++++++++++++ spec/factories/importing/importing_account.rb | 20 -- .../importing/importing_contractor.rb | 17 - .../importing/importing_customers_auth.rb | 68 ---- .../importing/importing_destination.rb | 40 --- .../factories/importing/importing_dialpeer.rb | 58 ---- .../importing/importing_disconnect_policy.rb | 9 - spec/factories/importing/importing_gateway.rb | 110 ------- .../importing/importing_gateway_group.rb | 12 - .../importing/importing_registration.rb | 23 -- .../importing/importing_routing_group.rb | 9 - .../importing_routing_tag_detection_rule.rb | 21 -- ...numberlist_item.rb => numberlist_items.rb} | 26 ++ ...importing_numberlist.rb => numberlists.rb} | 24 ++ .../{importing_rateplan.rb => rateplans.rb} | 12 + spec/factories/importing/registrations.rb | 55 ++++ spec/factories/importing/routing_groups.rb | 19 ++ .../importing/routing_tag_detection_rules.rb | 54 ++++ .../{routing/lnp_cache.rb => lnp/caches.rb} | 21 +- .../lnp/{lnp_databases.rb => databases.rb} | 16 +- spec/factories/lnp/routing_plan_lnp_rules.rb | 36 +++ ...tification.rb => balance_notifications.rb} | 8 +- .../log/{email_log.rb => email_logs.rb} | 20 +- .../{log/logic_log.rb => logic_logs.rb} | 10 +- spec/factories/node.rb | 15 - spec/factories/nodes.rb | 33 ++ .../attachments.rb} | 0 spec/factories/{payment.rb => payments.rb} | 23 ++ spec/factories/{pop.rb => pops.rb} | 11 + spec/factories/registration.rb | 19 -- .../custom_cdr_schedulers.rb} | 18 +- .../custom_cdr.rb => report/custom_cdrs.rb} | 10 +- spec/factories/report/custom_data.rb | 104 ++++++ .../report/customer_traffic_schedulers.rb | 25 ++ .../customer_traffics.rb} | 12 +- .../interval_cdr_schedulers.rb} | 22 +- spec/factories/report/interval_cdrs.rb | 33 ++ spec/factories/report/interval_data.rb | 95 ++++++ .../factories/report/realtime/bad_routings.rb | 165 ++++++++++ .../report/realtime/not_authenticateds.rb | 165 ++++++++++ .../scheduler_periods.rb} | 6 +- .../report/vendor_traffic_schedulers.rb | 25 ++ .../vendor_traffics.rb} | 12 +- spec/factories/reports/custom_data.rb | 7 - .../reports/customer_traffic_scheduler.rb | 21 -- spec/factories/reports/interval_cdr.rb | 27 -- spec/factories/reports/interval_data.rb | 8 - .../factories/reports/realtime/bad_routing.rb | 9 - .../reports/realtime/not_authenticated.rb | 9 - .../reports/vendor_traffic_scheduler.rb | 21 -- spec/factories/routing/area_prefix.rb | 9 - spec/factories/routing/area_prefixes.rb | 25 ++ spec/factories/routing/{area.rb => areas.rb} | 11 + spec/factories/routing/destination.rb | 33 -- .../routing/destination_next_rate.rb | 23 -- .../routing/destination_next_rates.rb | 44 +++ spec/factories/routing/destinations.rb | 78 +++++ spec/factories/routing/numberlist.rb | 20 -- spec/factories/routing/numberlist_item.rb | 16 - spec/factories/routing/numberlist_items.rb | 49 +++ spec/factories/routing/numberlists.rb | 53 +++ spec/factories/routing/rate_group.rb | 12 - spec/factories/routing/rate_groups.rb | 25 ++ .../routing/{rateplan.rb => rateplans.rb} | 17 + .../routing/routeset_discriminator.rb | 7 - .../routing/routeset_discriminators.rb | 18 ++ .../{routing_group.rb => routing_groups.rb} | 11 + spec/factories/routing/routing_plan.rb | 26 -- .../routing/routing_plan_lnp_rule.rb | 23 -- .../routing/routing_plan_static_route.rb | 7 - .../routing/routing_plan_static_routes.rb | 34 ++ spec/factories/routing/routing_plans.rb | 56 ++++ .../routing/routing_tag_detection_rule.rb | 27 -- .../routing/routing_tag_detection_rules.rb | 38 +++ .../{routing_tag.rb => routing_tags.rb} | 11 + spec/factories/routing/static_route.rb | 12 - .../routing/{tag_action.rb => tag_actions.rb} | 6 +- .../{rx_stream.rb => rx_streams.rb} | 37 +++ spec/factories/rtp_statistics/tx_stream.rb | 38 --- spec/factories/rtp_statistics/tx_streams.rb | 71 ++++ spec/factories/sensor.rb | 16 - ...ig_gws.rb => active_call_orig_gateways.rb} | 2 +- ...rm_gws.rb => active_call_term_gateways.rb} | 2 +- .../termination_quality_stats.rb} | 21 +- .../{api_log_config.rb => api_log_configs.rb} | 7 +- spec/factories/system/background_test.rb | 27 -- spec/factories/system/cdr_config.rb | 23 -- spec/factories/system/cdr_configs.rb | 29 ++ ...round_mode.rb => cdr_price_round_modes.rb} | 7 +- .../{cdr_round_mode.rb => cdr_round_modes.rb} | 6 +- .../system/{country.rb => countries.rb} | 12 + .../{lnp_resolver.rb => lnp_resolvers.rb} | 10 +- spec/factories/system/load_balacer.rb | 13 - spec/factories/system/load_balancers.rb | 26 ++ .../system/{lua_script.rb => lua_scripts.rb} | 14 + spec/factories/system/network_prefix.rb | 26 -- spec/factories/system/network_prefixes.rb | 37 +++ spec/factories/system/network_type.rb | 12 - spec/factories/system/network_types.rb | 25 ++ .../system/{network.rb => networks.rb} | 14 +- spec/factories/system/sensors.rb | 39 +++ spec/factories/system/smtp_connection.rb | 15 - spec/factories/system/smtp_connections.rb | 33 ++ .../system/{timezone.rb => timezones.rb} | 14 + spec/factories/termination_quality_stat.rb | 29 -- 162 files changed, 4140 insertions(+), 1630 deletions(-) rename spec/factories/{account.rb => accounts.rb} (64%) delete mode 100644 spec/factories/admin_user.rb create mode 100644 spec/factories/admin_users.rb rename spec/factories/{log/audit_log_item.rb => audit_log_items.rb} (65%) delete mode 100644 spec/factories/auth_log.rb create mode 100644 spec/factories/background_tasks.rb delete mode 100644 spec/factories/batch_update_form/account.rb delete mode 100644 spec/factories/billing/contact.rb create mode 100644 spec/factories/billing/contacts.rb delete mode 100644 spec/factories/billing/invoice_template.rb create mode 100644 spec/factories/billing/invoice_templates.rb delete mode 100644 spec/factories/billing/package_counter.rb create mode 100644 spec/factories/billing/package_counters.rb create mode 100644 spec/factories/cdr/auth_logs.rb delete mode 100644 spec/factories/cdr/cdr.rb delete mode 100644 spec/factories/cdr/cdr_export.rb create mode 100644 spec/factories/cdr/cdrs.rb create mode 100644 spec/factories/cdr_exports.rb create mode 100644 spec/factories/cnam/database_https.rb create mode 100644 spec/factories/cnam/databases.rb rename spec/factories/{codec_group.rb => codec_groups.rb} (61%) delete mode 100644 spec/factories/contractor.rb create mode 100644 spec/factories/contractors.rb delete mode 100644 spec/factories/customers_auth.rb create mode 100644 spec/factories/customers_auths.rb delete mode 100644 spec/factories/dialpeer.rb delete mode 100644 spec/factories/dialpeer_next_rate.rb create mode 100644 spec/factories/dialpeer_next_rates.rb create mode 100644 spec/factories/dialpeers.rb rename spec/factories/{disconnect_code.rb => disconnect_codes.rb} (97%) delete mode 100644 spec/factories/equipment/cnam_database.rb delete mode 100644 spec/factories/equipment/cnam_database_http.rb delete mode 100644 spec/factories/equipment/radius/accounting_profile.rb rename spec/factories/equipment/radius/{accounting_profile_start_attribute.rb => accounting_profile_start_attributes.rb} (66%) rename spec/factories/equipment/radius/{accounting_profile_stop_attribute.rb => accounting_profile_stop_attributes.rb} (66%) create mode 100644 spec/factories/equipment/radius/accounting_profiles.rb delete mode 100644 spec/factories/equipment/radius/auth_profile.rb create mode 100644 spec/factories/equipment/radius/auth_profiles.rb create mode 100644 spec/factories/equipment/registrations.rb rename spec/factories/equipment/{stir_shaken_signing_certificate.rb => stir_shaken/signing_certificates.rb} (59%) rename spec/factories/equipment/{stir_shaken_trusted_certificate.rb => stir_shaken/trusted_certificates.rb} (57%) create mode 100644 spec/factories/equipment/stir_shaken/trusted_repositories.rb delete mode 100644 spec/factories/equipment/stir_shaken_trusted_repository.rb rename spec/factories/{log/event.rb => events.rb} (59%) delete mode 100644 spec/factories/gateway.rb delete mode 100644 spec/factories/gateway_group.rb create mode 100644 spec/factories/gateway_groups.rb create mode 100644 spec/factories/gateways.rb delete mode 100644 spec/factories/gateways_stat.rb create mode 100644 spec/factories/gateways_stats.rb create mode 100644 spec/factories/importing/accounts.rb create mode 100644 spec/factories/importing/contractors.rb create mode 100644 spec/factories/importing/customers_auths.rb create mode 100644 spec/factories/importing/destinations.rb create mode 100644 spec/factories/importing/dialpeers.rb create mode 100644 spec/factories/importing/disconnect_policies.rb create mode 100644 spec/factories/importing/gateway_groups.rb create mode 100644 spec/factories/importing/gateways.rb delete mode 100644 spec/factories/importing/importing_account.rb delete mode 100644 spec/factories/importing/importing_contractor.rb delete mode 100644 spec/factories/importing/importing_customers_auth.rb delete mode 100644 spec/factories/importing/importing_destination.rb delete mode 100644 spec/factories/importing/importing_dialpeer.rb delete mode 100644 spec/factories/importing/importing_disconnect_policy.rb delete mode 100644 spec/factories/importing/importing_gateway.rb delete mode 100644 spec/factories/importing/importing_gateway_group.rb delete mode 100644 spec/factories/importing/importing_registration.rb delete mode 100644 spec/factories/importing/importing_routing_group.rb delete mode 100644 spec/factories/importing/importing_routing_tag_detection_rule.rb rename spec/factories/importing/{importing_numberlist_item.rb => numberlist_items.rb} (55%) rename spec/factories/importing/{importing_numberlist.rb => numberlists.rb} (56%) rename spec/factories/importing/{importing_rateplan.rb => rateplans.rb} (51%) create mode 100644 spec/factories/importing/registrations.rb create mode 100644 spec/factories/importing/routing_groups.rb create mode 100644 spec/factories/importing/routing_tag_detection_rules.rb rename spec/factories/{routing/lnp_cache.rb => lnp/caches.rb} (50%) rename spec/factories/lnp/{lnp_databases.rb => databases.rb} (64%) create mode 100644 spec/factories/lnp/routing_plan_lnp_rules.rb rename spec/factories/log/{balance_notification.rb => balance_notifications.rb} (82%) rename spec/factories/log/{email_log.rb => email_logs.rb} (65%) rename spec/factories/{log/logic_log.rb => logic_logs.rb} (64%) delete mode 100644 spec/factories/node.rb create mode 100644 spec/factories/nodes.rb rename spec/factories/{system/notification_attachment.rb => notification/attachments.rb} (100%) rename spec/factories/{payment.rb => payments.rb} (56%) rename spec/factories/{pop.rb => pops.rb} (68%) delete mode 100644 spec/factories/registration.rb rename spec/factories/{reports/custom_cdr_scheduler.rb => report/custom_cdr_schedulers.rb} (55%) rename spec/factories/{reports/custom_cdr.rb => report/custom_cdrs.rb} (84%) create mode 100644 spec/factories/report/custom_data.rb create mode 100644 spec/factories/report/customer_traffic_schedulers.rb rename spec/factories/{reports/customer_traffic.rb => report/customer_traffics.rb} (54%) rename spec/factories/{reports/interval_cdr_scheduler.rb => report/interval_cdr_schedulers.rb} (56%) create mode 100644 spec/factories/report/interval_cdrs.rb create mode 100644 spec/factories/report/interval_data.rb create mode 100644 spec/factories/report/realtime/bad_routings.rb create mode 100644 spec/factories/report/realtime/not_authenticateds.rb rename spec/factories/{reports/period_scheduler.rb => report/scheduler_periods.rb} (74%) create mode 100644 spec/factories/report/vendor_traffic_schedulers.rb rename spec/factories/{reports/vendor_traffic.rb => report/vendor_traffics.rb} (51%) delete mode 100644 spec/factories/reports/custom_data.rb delete mode 100644 spec/factories/reports/customer_traffic_scheduler.rb delete mode 100644 spec/factories/reports/interval_cdr.rb delete mode 100644 spec/factories/reports/interval_data.rb delete mode 100644 spec/factories/reports/realtime/bad_routing.rb delete mode 100644 spec/factories/reports/realtime/not_authenticated.rb delete mode 100644 spec/factories/reports/vendor_traffic_scheduler.rb delete mode 100644 spec/factories/routing/area_prefix.rb create mode 100644 spec/factories/routing/area_prefixes.rb rename spec/factories/routing/{area.rb => areas.rb} (66%) delete mode 100644 spec/factories/routing/destination.rb delete mode 100644 spec/factories/routing/destination_next_rate.rb create mode 100644 spec/factories/routing/destination_next_rates.rb create mode 100644 spec/factories/routing/destinations.rb delete mode 100644 spec/factories/routing/numberlist.rb delete mode 100644 spec/factories/routing/numberlist_item.rb create mode 100644 spec/factories/routing/numberlist_items.rb create mode 100644 spec/factories/routing/numberlists.rb delete mode 100644 spec/factories/routing/rate_group.rb create mode 100644 spec/factories/routing/rate_groups.rb rename spec/factories/routing/{rateplan.rb => rateplans.rb} (55%) delete mode 100644 spec/factories/routing/routeset_discriminator.rb create mode 100644 spec/factories/routing/routeset_discriminators.rb rename spec/factories/routing/{routing_group.rb => routing_groups.rb} (54%) delete mode 100644 spec/factories/routing/routing_plan.rb delete mode 100644 spec/factories/routing/routing_plan_lnp_rule.rb delete mode 100644 spec/factories/routing/routing_plan_static_route.rb create mode 100644 spec/factories/routing/routing_plan_static_routes.rb create mode 100644 spec/factories/routing/routing_plans.rb delete mode 100644 spec/factories/routing/routing_tag_detection_rule.rb create mode 100644 spec/factories/routing/routing_tag_detection_rules.rb rename spec/factories/routing/{routing_tag.rb => routing_tags.rb} (65%) delete mode 100644 spec/factories/routing/static_route.rb rename spec/factories/routing/{tag_action.rb => tag_actions.rb} (73%) rename spec/factories/rtp_statistics/{rx_stream.rb => rx_streams.rb} (50%) delete mode 100644 spec/factories/rtp_statistics/tx_stream.rb create mode 100644 spec/factories/rtp_statistics/tx_streams.rb delete mode 100644 spec/factories/sensor.rb rename spec/factories/stats/{active_call_orig_gws.rb => active_call_orig_gateways.rb} (94%) rename spec/factories/stats/{active_call_term_gws.rb => active_call_term_gateways.rb} (94%) rename spec/factories/{quality_stat.rb => stats/termination_quality_stats.rb} (52%) rename spec/factories/system/{api_log_config.rb => api_log_configs.rb} (71%) delete mode 100644 spec/factories/system/background_test.rb delete mode 100644 spec/factories/system/cdr_config.rb create mode 100644 spec/factories/system/cdr_configs.rb rename spec/factories/system/{cdr_price_round_mode.rb => cdr_price_round_modes.rb} (77%) rename spec/factories/system/{cdr_round_mode.rb => cdr_round_modes.rb} (82%) rename spec/factories/system/{country.rb => countries.rb} (65%) rename spec/factories/system/{lnp_resolver.rb => lnp_resolvers.rb} (70%) delete mode 100644 spec/factories/system/load_balacer.rb create mode 100644 spec/factories/system/load_balancers.rb rename spec/factories/system/{lua_script.rb => lua_scripts.rb} (63%) delete mode 100644 spec/factories/system/network_prefix.rb create mode 100644 spec/factories/system/network_prefixes.rb delete mode 100644 spec/factories/system/network_type.rb create mode 100644 spec/factories/system/network_types.rb rename spec/factories/system/{network.rb => networks.rb} (71%) create mode 100644 spec/factories/system/sensors.rb delete mode 100644 spec/factories/system/smtp_connection.rb create mode 100644 spec/factories/system/smtp_connections.rb rename spec/factories/system/{timezone.rb => timezones.rb} (64%) delete mode 100644 spec/factories/termination_quality_stat.rb diff --git a/spec/factories/account.rb b/spec/factories/accounts.rb similarity index 64% rename from spec/factories/account.rb rename to spec/factories/accounts.rb index 0424e279c..c0ca69ed0 100644 --- a/spec/factories/account.rb +++ b/spec/factories/accounts.rb @@ -1,5 +1,43 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: billing.accounts +# +# id :integer(4) not null, primary key +# balance :decimal(, ) not null +# destination_rate_limit :decimal(, ) +# invoice_ref_template :string default("$id"), not null +# max_balance :decimal(, ) not null +# max_call_duration :integer(4) +# min_balance :decimal(, ) not null +# name :string not null +# next_invoice_at :timestamptz +# origination_capacity :integer(2) +# send_invoices_to :integer(4) is an Array +# termination_capacity :integer(2) +# total_capacity :integer(2) +# uuid :uuid not null +# vat :decimal(, ) default(0.0), not null +# contractor_id :integer(4) not null +# external_id :bigint(8) +# invoice_period_id :integer(2) +# invoice_template_id :integer(4) +# next_invoice_type_id :integer(2) +# timezone_id :integer(4) default(1), not null +# +# Indexes +# +# accounts_contractor_id_idx (contractor_id) +# accounts_external_id_key (external_id) UNIQUE +# accounts_name_key (name) UNIQUE +# accounts_uuid_key (uuid) UNIQUE +# +# Foreign Keys +# +# accounts_contractor_id_fkey (contractor_id => contractors.id) +# accounts_timezone_id_fkey (timezone_id => timezones.id) +# FactoryBot.define do factory :account, class: Account do sequence(:name) { |n| "account#{n}" } diff --git a/spec/factories/admin_user.rb b/spec/factories/admin_user.rb deleted file mode 100644 index 9f6cf5633..000000000 --- a/spec/factories/admin_user.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :admin_user do - sequence(:username) { |n| "admin#{n}" } - sequence(:email) { |n| "admin#{n}@example.com" } - password { '111111' } - roles { ['user'] } - after(:build) do |admin| - if admin.class.ldap? - admin.encrypted_password = admin.encrypt_password(admin.password) - end - end - - trait :filled do - association :billing_contact, factory: :contact - end - end -end diff --git a/spec/factories/admin_users.rb b/spec/factories/admin_users.rb new file mode 100644 index 000000000..132fe1ca6 --- /dev/null +++ b/spec/factories/admin_users.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: admin_users +# +# id :integer(4) not null, primary key +# allowed_ips :inet is an Array +# current_sign_in_at :timestamptz +# current_sign_in_ip :string(255) +# enabled :boolean default(TRUE) +# encrypted_password :string(255) default(""), not null +# last_sign_in_at :timestamptz +# last_sign_in_ip :string(255) +# per_page :json not null +# remember_created_at :timestamptz +# reset_password_sent_at :timestamptz +# reset_password_token :string(255) +# roles :string not null, is an Array +# saved_filters :json not null +# sign_in_count :integer(4) default(0) +# stateful_filters :boolean default(FALSE), not null +# username :string not null +# visible_columns :json not null +# created_at :timestamptz not null +# updated_at :timestamptz not null +# +# Indexes +# +# admin_users_username_idx (username) UNIQUE +# admin_users_username_key (username) UNIQUE +# index_admin_users_on_reset_password_token (reset_password_token) UNIQUE +# +FactoryBot.define do + factory :admin_user do + sequence(:username) { |n| "admin#{n}" } + sequence(:email) { |n| "admin#{n}@example.com" } + password { '111111' } + roles { ['user'] } + after(:build) do |admin| + if admin.class.ldap? + admin.encrypted_password = admin.encrypt_password(admin.password) + end + end + + trait :filled do + association :billing_contact, factory: :contact + end + end +end diff --git a/spec/factories/log/audit_log_item.rb b/spec/factories/audit_log_items.rb similarity index 65% rename from spec/factories/log/audit_log_item.rb rename to spec/factories/audit_log_items.rb index 59ce13e8c..6fdb17c6b 100644 --- a/spec/factories/log/audit_log_item.rb +++ b/spec/factories/audit_log_items.rb @@ -4,16 +4,20 @@ # # Table name: versions # -# id :integer not null, primary key -# item_type :string(255) not null -# item_id :integer not null +# id :integer(4) not null, primary key # event :string(255) not null -# whodunnit :string(255) -# object :text -# created_at :datetime # ip :string(255) +# item_type :string(255) not null +# object :text # object_changes :text -# txid :integer +# txid :bigint(8) +# whodunnit :string(255) +# created_at :timestamptz +# item_id :bigint(8) not null +# +# Indexes +# +# index_versions_on_item_type_and_item_id (item_type,item_id) # FactoryBot.define do diff --git a/spec/factories/auth_log.rb b/spec/factories/auth_log.rb deleted file mode 100644 index 374676843..000000000 --- a/spec/factories/auth_log.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :auth_log, class: Cdr::AuthLog do - request_time { 1.minute.ago } - code { 200 } - reason { 'OK' } - internal_reason { 'Response matched' } - origination_ip { '1.1.1.1' } - origination_port { 5060 } - transport_remote_ip { '2.2.2.2' } - transport_remote_port { 6050 } - transport_local_ip { '2.2.2.2' } - transport_local_port { 6050 } - username { 'User1' } - realm { 'Realm1' } - request_method { 'INVITE' } - call_id { '2b8a45f5730c1b3459a00b9c322a79da' } - success { true } - - transport_protocol { Equipment::TransportProtocol.take } - origination_protocol { Equipment::TransportProtocol.take } - - # association :transport_protocol, factory: :transport_protocol - # association :origination_protocol, factory: :transport_protocol - - association :gateway, factory: :gateway - association :pop, factory: :pop - association :node, factory: :node - - trait :with_id do - id { Cdr::AuthLog.connection.select_value("SELECT nextval('auth_log.auth_log_id_seq')").to_i } - end - - before(:create) do |record, _evaluator| - # Create partition for current record - Cdr::AuthLog.add_partition_for(record.request_time) if record.request_time - end - end -end diff --git a/spec/factories/background_tasks.rb b/spec/factories/background_tasks.rb new file mode 100644 index 000000000..0221b6d77 --- /dev/null +++ b/spec/factories/background_tasks.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: delayed_jobs +# +# id :integer(4) not null, primary key +# attempts :integer(4) default(0), not null +# failed_at :timestamptz +# handler :text not null +# last_error :text +# locked_at :timestamptz +# locked_by :string(255) +# priority :integer(4) default(0), not null +# queue :string(255) +# run_at :timestamptz +# unique_name :string +# created_at :timestamptz not null +# updated_at :timestamptz not null +# +# Indexes +# +# delayed_jobs_priority (priority,run_at) +# + +FactoryBot.define do + factory :background_task, class: BackgroundTask do + priority { 0 } + attempts { 0 } + handler { "--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper\njob_data:\n job_class: Worker::CdrExportJob\n job_id: 71b02934-f68e-4a98-a90c-de8d274a37ed\n provider_job_id: \n queue_name: cdr_export\n priority: \n arguments:\n - 1\n executions: 0\n locale: en\n" } + end +end diff --git a/spec/factories/batch_update_form/account.rb b/spec/factories/batch_update_form/account.rb deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/factories/billing/contact.rb b/spec/factories/billing/contact.rb deleted file mode 100644 index 94198ade0..000000000 --- a/spec/factories/billing/contact.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :contact, class: Billing::Contact do - sequence(:email) { |n| "rspec_mail_#{n}@example.com" } - - association :contractor, factory: :customer - - trait :filled do - association :contractor, factory: :customer - admin_user { build(:admin_user, :filled) } - end - end -end diff --git a/spec/factories/billing/contacts.rb b/spec/factories/billing/contacts.rb new file mode 100644 index 000000000..19e627162 --- /dev/null +++ b/spec/factories/billing/contacts.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: notifications.contacts +# +# id :integer(4) not null, primary key +# email :string not null +# notes :string +# created_at :timestamptz +# updated_at :timestamptz +# admin_user_id :integer(4) +# contractor_id :integer(4) +# +# Indexes +# +# contacts_contractor_id_idx (contractor_id) +# +# Foreign Keys +# +# contacts_admin_user_id_fkey (admin_user_id => admin_users.id) +# contacts_contractor_id_fkey (contractor_id => contractors.id) +# +FactoryBot.define do + factory :contact, class: Billing::Contact do + sequence(:email) { |n| "rspec_mail_#{n}@example.com" } + + association :contractor, factory: :customer + + trait :filled do + association :contractor, factory: :customer + admin_user { build(:admin_user, :filled) } + end + end +end diff --git a/spec/factories/billing/invoice_template.rb b/spec/factories/billing/invoice_template.rb deleted file mode 100644 index 4715fa8ee..000000000 --- a/spec/factories/billing/invoice_template.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :invoice_template, class: Billing::InvoiceTemplate do - sequence(:name) { |n| "invoice_template#{n}" } - filename { 'filename.odt' } - end -end diff --git a/spec/factories/billing/invoice_templates.rb b/spec/factories/billing/invoice_templates.rb new file mode 100644 index 000000000..3804668a4 --- /dev/null +++ b/spec/factories/billing/invoice_templates.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: invoice_templates +# +# id :integer(4) not null, primary key +# data :binary +# filename :string not null +# name :string not null +# sha1 :string +# created_at :timestamptz +# +# Indexes +# +# invoices_templates_name_key (name) UNIQUE +# +FactoryBot.define do + factory :invoice_template, class: Billing::InvoiceTemplate do + sequence(:name) { |n| "invoice_template#{n}" } + filename { 'filename.odt' } + end +end diff --git a/spec/factories/billing/package_counter.rb b/spec/factories/billing/package_counter.rb deleted file mode 100644 index 09c95a1d2..000000000 --- a/spec/factories/billing/package_counter.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :billing_package_counter, class: Billing::PackageCounter do - account { FactoryBot.create(:account) } - service { FactoryBot.create(:service) } - prefix { '' } - duration { 120 } - exclude { false } - end -end diff --git a/spec/factories/billing/package_counters.rb b/spec/factories/billing/package_counters.rb new file mode 100644 index 000000000..24d1dca46 --- /dev/null +++ b/spec/factories/billing/package_counters.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: billing.package_counters +# +# id :bigint(8) not null, primary key +# duration :integer(4) default(0), not null +# exclude :boolean default(FALSE), not null +# prefix :string not null +# account_id :integer(4) not null +# service_id :bigint(8) +# +# Indexes +# +# package_counters_account_id_idx (account_id) +# package_counters_prefix_idx (((prefix)::prefix_range)) USING gist +# package_counters_service_id_idx (service_id) +# +# Foreign Keys +# +# package_counters_account_id_fkey (account_id => accounts.id) +# +FactoryBot.define do + factory :billing_package_counter, class: Billing::PackageCounter do + account { FactoryBot.create(:account) } + service { FactoryBot.create(:service) } + prefix { '' } + duration { 120 } + exclude { false } + end +end diff --git a/spec/factories/cdr/auth_logs.rb b/spec/factories/cdr/auth_logs.rb new file mode 100644 index 000000000..8bd8d653d --- /dev/null +++ b/spec/factories/cdr/auth_logs.rb @@ -0,0 +1,83 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: auth_log.auth_log +# +# id :bigint(8) not null, primary key +# code :integer(2) +# diversion :string +# from_uri :string +# internal_reason :string +# nonce :string +# origination_ip :string +# origination_port :integer(4) +# pai :string +# ppi :string +# privacy :string +# realm :string +# reason :string +# request_method :string +# request_time :timestamptz not null +# response :string +# rpid :string +# rpid_privacy :string +# ruri :string +# success :boolean +# to_uri :string +# transport_local_ip :string +# transport_local_port :integer(4) +# transport_remote_ip :string +# transport_remote_port :integer(4) +# username :string +# x_yeti_auth :string +# call_id :string +# gateway_id :integer(4) +# node_id :integer(2) +# origination_proto_id :integer(2) +# pop_id :integer(2) +# transport_proto_id :integer(2) +# +# Indexes +# +# auth_log_id_idx (id) +# auth_log_request_time_idx (request_time) +# +FactoryBot.define do + factory :auth_log, class: Cdr::AuthLog do + request_time { 1.minute.ago } + code { 200 } + reason { 'OK' } + internal_reason { 'Response matched' } + origination_ip { '1.1.1.1' } + origination_port { 5060 } + transport_remote_ip { '2.2.2.2' } + transport_remote_port { 6050 } + transport_local_ip { '2.2.2.2' } + transport_local_port { 6050 } + username { 'User1' } + realm { 'Realm1' } + request_method { 'INVITE' } + call_id { '2b8a45f5730c1b3459a00b9c322a79da' } + success { true } + + transport_protocol { Equipment::TransportProtocol.take } + origination_protocol { Equipment::TransportProtocol.take } + + # association :transport_protocol, factory: :transport_protocol + # association :origination_protocol, factory: :transport_protocol + + association :gateway, factory: :gateway + association :pop, factory: :pop + association :node, factory: :node + + trait :with_id do + id { Cdr::AuthLog.connection.select_value("SELECT nextval('auth_log.auth_log_id_seq')").to_i } + end + + before(:create) do |record, _evaluator| + # Create partition for current record + Cdr::AuthLog.add_partition_for(record.request_time) if record.request_time + end + end +end diff --git a/spec/factories/cdr/cdr.rb b/spec/factories/cdr/cdr.rb deleted file mode 100644 index 2ff92d941..000000000 --- a/spec/factories/cdr/cdr.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :cdr, class: Cdr::Cdr do - uuid { SecureRandom.uuid } - is_last_cdr { true } - time_start { 1.minute.ago } - time_connect { 1.minute.ago } - time_end { 30.seconds.ago } - duration { 30 } - success { true } - destination_initial_interval { 30 } - destination_initial_rate { 10.50 } - destination_next_interval { 60 } - destination_next_rate { 8.20 } - destination_fee { 3.15 } - customer_price { 2.00 } - src_name_in { 'Src name In' } - src_prefix_in { '123' } - from_domain { 'From Domain' } - dst_prefix_in { '456' } - to_domain { 'To Domain' } - ruri_domain { 'rURI Domain' } - diversion_in { 'Deversion In' } - local_tag { 'EU' } - lega_disconnect_code { 200 } - lega_disconnect_reason { 201 } - auth_orig_ip { '127.0.0.1' } - auth_orig_port { 8080 } - src_prefix_routing { 'SRC Prefix Routing' } - dst_prefix_routing { 'DST Prefix Routing' } - destination_prefix { 'Destination Prefix' } - - auth_orig_transport_protocol { Equipment::TransportProtocol.take } - - # association :customer # customer_id - association :customer_acc, factory: :account # customer_acc_id - association :vendor_acc, factory: :account - - before(:create) do |record, _evaluator| - # Create partition for current+next monthes if not exists - Cdr::Cdr.add_partition_for(record.time_start.utc) - - # link Customer from associated Account - unless record.customer_id - record.customer_id = record.customer_acc.contractor_id - end - - # link Vendor from associated Account - unless record.vendor_id - record.vendor_id = record.vendor_acc.contractor_id - end - end - - trait :with_id do - id { Cdr::Cdr.connection.select_value("SELECT nextval('cdr.cdr_id_seq')").to_i } - end - - trait :with_id_and_uuid do - id { Cdr::Cdr.connection.select_value("SELECT nextval('cdr.cdr_id_seq')").to_i } - uuid { SecureRandom.uuid } - end - end -end diff --git a/spec/factories/cdr/cdr_export.rb b/spec/factories/cdr/cdr_export.rb deleted file mode 100644 index affb74485..000000000 --- a/spec/factories/cdr/cdr_export.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :cdr_export, class: CdrExport do - type { 'Base' } - callback_url { nil } - filters do - { - time_start_gteq: '2018-01-01', - time_start_lteq: '2018-03-01' - } - end - fields { %i[success id] } - status { nil } - - trait :completed do - status { CdrExport::STATUS_COMPLETED } - end - - trait :failed do - status { CdrExport::STATUS_FAILED } - end - - trait :deleted do - status { CdrExport::STATUS_DELETED } - end - end -end diff --git a/spec/factories/cdr/cdrs.rb b/spec/factories/cdr/cdrs.rb new file mode 100644 index 000000000..f6c11760e --- /dev/null +++ b/spec/factories/cdr/cdrs.rb @@ -0,0 +1,220 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: cdr.cdr +# +# id :bigint(8) not null, primary key +# audio_recorded :boolean +# auth_orig_ip :inet +# auth_orig_port :integer(4) +# core_version :string +# customer_acc_vat :decimal(, ) +# customer_account_check_balance :boolean +# customer_auth_external_type :string +# customer_auth_name :string +# customer_duration :integer(4) +# customer_price :decimal(, ) +# customer_price_no_vat :decimal(, ) +# destination_fee :decimal(, ) +# destination_initial_interval :integer(4) +# destination_initial_rate :decimal(, ) +# destination_next_interval :integer(4) +# destination_next_rate :decimal(, ) +# destination_prefix :string +# destination_reverse_billing :boolean +# dialpeer_fee :decimal(, ) +# dialpeer_initial_interval :integer(4) +# dialpeer_initial_rate :decimal(, ) +# dialpeer_next_interval :integer(4) +# dialpeer_next_rate :decimal(, ) +# dialpeer_prefix :string +# dialpeer_reverse_billing :boolean +# diversion_in :string +# diversion_out :string +# dst_prefix_in :string +# dst_prefix_out :string +# dst_prefix_routing :string +# duration :integer(4) +# early_media_present :boolean +# from_domain :string +# global_tag :string +# internal_disconnect_code :integer(4) +# internal_disconnect_reason :string +# is_last_cdr :boolean +# is_redirected :boolean +# lega_disconnect_code :integer(4) +# lega_disconnect_reason :string +# lega_identity :jsonb +# lega_q850_cause :integer(2) +# lega_q850_params :string +# lega_q850_text :string +# lega_user_agent :string +# legb_disconnect_code :integer(4) +# legb_disconnect_reason :string +# legb_local_tag :string +# legb_outbound_proxy :string +# legb_q850_cause :integer(2) +# legb_q850_params :string +# legb_q850_text :string +# legb_ruri :string +# legb_user_agent :string +# local_tag :string +# lrn :string +# metadata :jsonb +# p_charge_info_in :string +# pai_in :string +# pai_out :string +# pdd :float +# ppi_in :string +# ppi_out :string +# privacy_in :string +# privacy_out :string +# profit :decimal(, ) +# routing_attempt :integer(4) +# routing_delay :float +# routing_tag_ids :integer(2) is an Array +# rpid_in :string +# rpid_out :string +# rpid_privacy_in :string +# rpid_privacy_out :string +# rtt :float +# ruri_domain :string +# sign_orig_ip :string +# sign_orig_local_ip :string +# sign_orig_local_port :integer(4) +# sign_orig_port :integer(4) +# sign_term_ip :string +# sign_term_local_ip :string +# sign_term_local_port :integer(4) +# sign_term_port :integer(4) +# src_name_in :string +# src_name_out :string +# src_prefix_in :string +# src_prefix_out :string +# src_prefix_routing :string +# success :boolean +# time_connect :timestamptz +# time_end :timestamptz +# time_start :timestamptz not null +# to_domain :string +# uuid :uuid +# vendor_duration :integer(4) +# vendor_price :decimal(, ) +# yeti_version :string +# auth_orig_transport_protocol_id :integer(2) +# customer_acc_external_id :bigint(8) +# customer_acc_id :integer(4) +# customer_auth_external_id :bigint(8) +# customer_auth_id :integer(4) +# customer_external_id :bigint(8) +# customer_id :integer(4) +# customer_invoice_id :integer(4) +# destination_id :integer(4) +# destination_rate_policy_id :integer(4) +# dialpeer_id :integer(4) +# disconnect_initiator_id :integer(4) +# dst_area_id :integer(4) +# dst_country_id :integer(4) +# dst_network_id :integer(4) +# dump_level_id :integer(2) +# failed_resource_id :bigint(8) +# failed_resource_type_id :integer(2) +# internal_disconnect_code_id :integer(2) +# lega_ss_status_id :integer(2) +# legb_ss_status_id :integer(2) +# lnp_database_id :integer(2) +# node_id :integer(4) +# orig_call_id :string +# orig_gw_external_id :bigint(8) +# orig_gw_id :integer(4) +# package_counter_id :bigint(8) +# pop_id :integer(4) +# rateplan_id :integer(4) +# routing_group_id :integer(4) +# routing_plan_id :integer(4) +# sign_orig_transport_protocol_id :integer(2) +# sign_term_transport_protocol_id :integer(2) +# src_area_id :integer(4) +# src_country_id :integer(4) +# src_network_id :integer(4) +# term_call_id :string +# term_gw_external_id :bigint(8) +# term_gw_id :integer(4) +# vendor_acc_external_id :bigint(8) +# vendor_acc_id :integer(4) +# vendor_external_id :bigint(8) +# vendor_id :integer(4) +# vendor_invoice_id :integer(4) +# +# Indexes +# +# cdr_customer_acc_external_id_time_start_idx (customer_acc_external_id,time_start) WHERE is_last_cdr +# cdr_customer_acc_id_time_start_idx1 (customer_acc_id,time_start) +# cdr_customer_id_time_start_idx (customer_id,time_start) +# cdr_id_idx (id) +# cdr_time_start_idx (time_start) +# cdr_vendor_id_time_start_idx (vendor_id,time_start) +# +FactoryBot.define do + factory :cdr, class: Cdr::Cdr do + uuid { SecureRandom.uuid } + is_last_cdr { true } + time_start { 1.minute.ago } + time_connect { 1.minute.ago } + time_end { 30.seconds.ago } + duration { 30 } + success { true } + destination_initial_interval { 30 } + destination_initial_rate { 10.50 } + destination_next_interval { 60 } + destination_next_rate { 8.20 } + destination_fee { 3.15 } + customer_price { 2.00 } + src_name_in { 'Src name In' } + src_prefix_in { '123' } + from_domain { 'From Domain' } + dst_prefix_in { '456' } + to_domain { 'To Domain' } + ruri_domain { 'rURI Domain' } + diversion_in { 'Deversion In' } + local_tag { 'EU' } + lega_disconnect_code { 200 } + lega_disconnect_reason { 201 } + auth_orig_ip { '127.0.0.1' } + auth_orig_port { 8080 } + src_prefix_routing { 'SRC Prefix Routing' } + dst_prefix_routing { 'DST Prefix Routing' } + destination_prefix { 'Destination Prefix' } + + auth_orig_transport_protocol { Equipment::TransportProtocol.take } + + # association :customer # customer_id + association :customer_acc, factory: :account # customer_acc_id + association :vendor_acc, factory: :account + + before(:create) do |record, _evaluator| + # Create partition for current+next monthes if not exists + Cdr::Cdr.add_partition_for(record.time_start.utc) + + # link Customer from associated Account + unless record.customer_id + record.customer_id = record.customer_acc.contractor_id + end + + # link Vendor from associated Account + unless record.vendor_id + record.vendor_id = record.vendor_acc.contractor_id + end + end + + trait :with_id do + id { Cdr::Cdr.connection.select_value("SELECT nextval('cdr.cdr_id_seq')").to_i } + end + + trait :with_id_and_uuid do + id { Cdr::Cdr.connection.select_value("SELECT nextval('cdr.cdr_id_seq')").to_i } + uuid { SecureRandom.uuid } + end + end +end diff --git a/spec/factories/cdr_exports.rb b/spec/factories/cdr_exports.rb new file mode 100644 index 000000000..d71071c66 --- /dev/null +++ b/spec/factories/cdr_exports.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: cdr_exports +# +# id :integer(4) not null, primary key +# callback_url :string +# fields :string default([]), not null, is an Array +# filters :json not null +# rows_count :integer(4) +# status :string not null +# type :string not null +# uuid :uuid not null +# created_at :datetime +# updated_at :datetime +# customer_account_id :integer(4) +# +# Indexes +# +# index_sys.cdr_exports_on_customer_account_id (customer_account_id) +# index_sys.cdr_exports_on_uuid (uuid) UNIQUE +# +# Foreign Keys +# +# fk_rails_e796f29195 (customer_account_id => accounts.id) +# +FactoryBot.define do + factory :cdr_export, class: CdrExport do + type { 'Base' } + callback_url { nil } + filters do + { + time_start_gteq: '2018-01-01', + time_start_lteq: '2018-03-01' + } + end + fields { %i[success id] } + status { nil } + + trait :completed do + status { CdrExport::STATUS_COMPLETED } + end + + trait :failed do + status { CdrExport::STATUS_FAILED } + end + + trait :deleted do + status { CdrExport::STATUS_DELETED } + end + end +end diff --git a/spec/factories/cnam/database_https.rb b/spec/factories/cnam/database_https.rb new file mode 100644 index 000000000..a068e7035 --- /dev/null +++ b/spec/factories/cnam/database_https.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.cnam_databases_http +# +# id :integer(2) not null, primary key +# timeout :integer(2) default(5), not null +# url :string not null +# +FactoryBot.define do + factory :cnam_database_http, class: Cnam::DatabaseHttp do + url { 'https://example.com/{pai}' } + timeout { 15_000 } + end +end diff --git a/spec/factories/cnam/databases.rb b/spec/factories/cnam/databases.rb new file mode 100644 index 000000000..208c859ed --- /dev/null +++ b/spec/factories/cnam/databases.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.cnam_databases +# +# id :integer(2) not null, primary key +# database_type :string not null +# drop_call_on_error :boolean default(FALSE), not null +# name :string not null +# request_lua :string +# response_lua :string +# created_at :timestamptz +# database_id :integer(2) not null +# +# Indexes +# +# cnam_databases_name_key (name) UNIQUE +# +FactoryBot.define do + factory :cnam_database, class: Cnam::Database do + sequence(:name) { |n| "CNAM db script_#{n}" } + request_lua { 'arg.a="000"; table.insert(arg.v,9); return arg;' } + response_lua { 'arg.a="000"; table.insert(arg.v,9); return arg;' } + association :database, factory: :cnam_database_http + end +end diff --git a/spec/factories/codec_group.rb b/spec/factories/codec_groups.rb similarity index 61% rename from spec/factories/codec_group.rb rename to spec/factories/codec_groups.rb index b39b1d0d2..d6d74257a 100644 --- a/spec/factories/codec_group.rb +++ b/spec/factories/codec_groups.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: codec_groups +# +# id :integer(4) not null, primary key +# name :string not null +# +# Indexes +# +# codec_groups_name_key (name) UNIQUE +# FactoryBot.define do factory :codec_group do sequence(:name) { |n| "codec_group#{n}" } diff --git a/spec/factories/contractor.rb b/spec/factories/contractor.rb deleted file mode 100644 index f1c6f0595..000000000 --- a/spec/factories/contractor.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :contractor, class: Contractor do - sequence(:name) { |n| "contractor#{n}" } - enabled { true } - vendor { false } - customer { false } - - factory :customer do - vendor { false } - customer { true } - end - - factory :vendor do - vendor { true } - customer { false } - end - end -end diff --git a/spec/factories/contractors.rb b/spec/factories/contractors.rb new file mode 100644 index 000000000..2c5bae6fc --- /dev/null +++ b/spec/factories/contractors.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: contractors +# +# id :integer(4) not null, primary key +# address :string +# customer :boolean +# description :string +# enabled :boolean +# name :string +# phones :string +# vendor :boolean +# external_id :bigint(8) +# smtp_connection_id :integer(4) +# +# Indexes +# +# contractors_external_id_key (external_id) UNIQUE +# contractors_name_unique (name) UNIQUE +# +# Foreign Keys +# +# contractors_smtp_connection_id_fkey (smtp_connection_id => smtp_connections.id) +# +FactoryBot.define do + factory :contractor, class: Contractor do + sequence(:name) { |n| "contractor#{n}" } + enabled { true } + vendor { false } + customer { false } + + factory :customer do + vendor { false } + customer { true } + end + + factory :vendor do + vendor { true } + customer { false } + end + end +end diff --git a/spec/factories/customers_auth.rb b/spec/factories/customers_auth.rb deleted file mode 100644 index e004a82d7..000000000 --- a/spec/factories/customers_auth.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :customers_auth, class: CustomersAuth do - sequence(:name) { |n| "customers_auth_#{n}" } - diversion_policy_id { 1 } - dump_level_id { 1 } - - # ip { ['127.0.0.0/8'] } # default - src_number_field_id { 1 } - src_rewrite_rule { nil } - src_rewrite_result { nil } - - dst_number_field_id { 1 } - dst_rewrite_rule { nil } - dst_rewrite_result { nil } - - pop_id { nil } - - src_name_field_id { 1 } - src_name_rewrite_rule { nil } - src_name_rewrite_result { nil } - - diversion_rewrite_rule { nil } - diversion_rewrite_result { nil } - dst_numberlist_id { nil } - src_numberlist_id { nil } - allow_receive_rate_limit { false } - send_billing_information { false } - - association :rateplan - association :routing_plan - association :lua_script - - transient do - gateway_traits { [] } - end - - trait :with_incoming_auth do - gateway_traits { %i[with_incoming_auth] } - require_incoming_auth { true } - end - - trait :with_reject do - reject_calls { true } - end - - trait :filled do - with_incoming_auth - with_reject - tag_action { Routing::TagAction.take || FactoryBot.create(:tag_action) } - end - - trait :with_external_id do - sequence(:external_id) - end - - after(:build) do |record, ev| - record.customer ||= record.account.contractor if record.account - record.customer ||= record.gateway.contractor if record.gateway - record.customer ||= FactoryBot.create(:contractor, customer: true) - - record.account ||= FactoryBot.create(:account, contractor: record.customer) - record.gateway ||= FactoryBot.create(:gateway, *ev.gateway_traits, contractor: record.customer) - end - end -end diff --git a/spec/factories/customers_auths.rb b/spec/factories/customers_auths.rb new file mode 100644 index 000000000..0193316b9 --- /dev/null +++ b/spec/factories/customers_auths.rb @@ -0,0 +1,170 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.customers_auth +# +# id :integer(4) not null, primary key +# allow_receive_rate_limit :boolean default(FALSE), not null +# capacity :integer(2) +# check_account_balance :boolean default(TRUE), not null +# cps_limit :float +# diversion_rewrite_result :string +# diversion_rewrite_rule :string +# dst_number_max_length :integer(2) default(100), not null +# dst_number_min_length :integer(2) default(0), not null +# dst_number_radius_rewrite_result :string +# dst_number_radius_rewrite_rule :string +# dst_prefix :string default(["\"\""]), is an Array +# dst_rewrite_result :string +# dst_rewrite_rule :string +# enable_audio_recording :boolean default(FALSE), not null +# enabled :boolean default(TRUE), not null +# external_type :string +# from_domain :string default([]), is an Array +# interface :string default([]), not null, is an Array +# ip :inet default(["\"127.0.0.0/8\""]), is an Array +# name :string not null +# reject_calls :boolean default(FALSE), not null +# require_incoming_auth :boolean default(FALSE), not null +# send_billing_information :boolean default(FALSE), not null +# src_name_rewrite_result :string +# src_name_rewrite_rule :string +# src_number_max_length :integer(2) default(100), not null +# src_number_min_length :integer(2) default(0), not null +# src_number_radius_rewrite_result :string +# src_number_radius_rewrite_rule :string +# src_numberlist_use_diversion :boolean default(FALSE), not null +# src_prefix :string default(["\"\""]), is an Array +# src_rewrite_result :string +# src_rewrite_rule :string +# ss_dst_rewrite_result :string +# ss_dst_rewrite_rule :string +# ss_src_rewrite_result :string +# ss_src_rewrite_rule :string +# tag_action_value :integer(2) default([]), not null, is an Array +# to_domain :string default([]), is an Array +# uri_domain :string default([]), is an Array +# x_yeti_auth :string default([]), is an Array +# account_id :integer(4) +# cnam_database_id :integer(2) +# customer_id :integer(4) not null +# diversion_policy_id :integer(4) default(1), not null +# dst_number_field_id :integer(2) default(1), not null +# dst_numberlist_id :integer(2) +# dump_level_id :integer(2) default(0), not null +# external_id :bigint(8) +# gateway_id :integer(4) not null +# lua_script_id :integer(2) +# pop_id :integer(4) +# privacy_mode_id :integer(2) default(1), not null +# radius_accounting_profile_id :integer(2) +# radius_auth_profile_id :integer(2) +# rateplan_id :integer(4) not null +# rewrite_ss_status_id :integer(2) +# routing_plan_id :integer(4) not null +# src_name_field_id :integer(2) default(1), not null +# src_number_field_id :integer(2) default(1), not null +# src_numberlist_id :integer(2) +# ss_invalid_identity_action_id :integer(2) default(0), not null +# ss_mode_id :integer(2) default(0), not null +# ss_no_identity_action_id :integer(2) default(0), not null +# tag_action_id :integer(2) +# transport_protocol_id :integer(2) +# +# Indexes +# +# customers_auth_account_id_idx (account_id) +# customers_auth_customer_id_idx (customer_id) +# customers_auth_dst_numberlist_id_idx (dst_numberlist_id) +# customers_auth_external_id_external_type_key_uniq (external_id,external_type) UNIQUE +# customers_auth_external_id_key_uniq (external_id) UNIQUE WHERE (external_type IS NULL) +# customers_auth_name_key (name) UNIQUE +# customers_auth_src_numberlist_id_idx (src_numberlist_id) +# +# Foreign Keys +# +# customers_auth_account_id_fkey (account_id => accounts.id) +# customers_auth_cnam_database_id_fkey (cnam_database_id => cnam_databases.id) +# customers_auth_customer_id_fkey (customer_id => contractors.id) +# customers_auth_diversion_policy_id_fkey (diversion_policy_id => diversion_policy.id) +# customers_auth_dst_blacklist_id_fkey (dst_numberlist_id => numberlists.id) +# customers_auth_dst_number_field_id_fkey (dst_number_field_id => customers_auth_dst_number_fields.id) +# customers_auth_gateway_id_fkey (gateway_id => gateways.id) +# customers_auth_lua_script_id_fkey (lua_script_id => lua_scripts.id) +# customers_auth_pop_id_fkey (pop_id => pops.id) +# customers_auth_radius_accounting_profile_id_fkey (radius_accounting_profile_id => radius_accounting_profiles.id) +# customers_auth_radius_auth_profile_id_fkey (radius_auth_profile_id => radius_auth_profiles.id) +# customers_auth_rateplan_id_fkey (rateplan_id => rateplans.id) +# customers_auth_routing_plan_id_fkey (routing_plan_id => routing_plans.id) +# customers_auth_src_blacklist_id_fkey (src_numberlist_id => numberlists.id) +# customers_auth_src_name_field_id_fkey (src_name_field_id => customers_auth_src_name_fields.id) +# customers_auth_src_number_field_id_fkey (src_number_field_id => customers_auth_src_number_fields.id) +# customers_auth_tag_action_id_fkey (tag_action_id => tag_actions.id) +# customers_auth_transport_protocol_id_fkey (transport_protocol_id => transport_protocols.id) +# +FactoryBot.define do + factory :customers_auth, class: CustomersAuth do + sequence(:name) { |n| "customers_auth_#{n}" } + diversion_policy_id { 1 } + dump_level_id { 1 } + + # ip { ['127.0.0.0/8'] } # default + src_number_field_id { 1 } + src_rewrite_rule { nil } + src_rewrite_result { nil } + + dst_number_field_id { 1 } + dst_rewrite_rule { nil } + dst_rewrite_result { nil } + + pop_id { nil } + + src_name_field_id { 1 } + src_name_rewrite_rule { nil } + src_name_rewrite_result { nil } + + diversion_rewrite_rule { nil } + diversion_rewrite_result { nil } + dst_numberlist_id { nil } + src_numberlist_id { nil } + allow_receive_rate_limit { false } + send_billing_information { false } + + association :rateplan + association :routing_plan + association :lua_script + + transient do + gateway_traits { [] } + end + + trait :with_incoming_auth do + gateway_traits { %i[with_incoming_auth] } + require_incoming_auth { true } + end + + trait :with_reject do + reject_calls { true } + end + + trait :filled do + with_incoming_auth + with_reject + tag_action { Routing::TagAction.take || FactoryBot.create(:tag_action) } + end + + trait :with_external_id do + sequence(:external_id) + end + + after(:build) do |record, ev| + record.customer ||= record.account.contractor if record.account + record.customer ||= record.gateway.contractor if record.gateway + record.customer ||= FactoryBot.create(:contractor, customer: true) + + record.account ||= FactoryBot.create(:account, contractor: record.customer) + record.gateway ||= FactoryBot.create(:gateway, *ev.gateway_traits, contractor: record.customer) + end + end +end diff --git a/spec/factories/dialpeer.rb b/spec/factories/dialpeer.rb deleted file mode 100644 index bc62ada3d..000000000 --- a/spec/factories/dialpeer.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :dialpeer, class: Dialpeer do - sequence(:external_id) - enabled { true } - reverse_billing { false } - prefix { nil } - src_rewrite_rule { nil } - dst_rewrite_rule { nil } - acd_limit { 0 } - asr_limit { 0 } - gateway_id { nil } - routing_group_id { nil } - connect_fee { 0 } - src_rewrite_result { nil } - dst_rewrite_result { nil } - locked { false } - priority { 100 } - capacity { 1 } - lcr_rate_multiplier { 1 } - next_rate { 0.0 } - initial_rate { 0.0 } - next_interval { 60 } - initial_interval { 60 } - - valid_from { 10.days.ago.utc } - valid_till { 10.days.from_now.utc } - - association :routing_group - association :routeset_discriminator - - after :build do |dialpeer| - dialpeer.vendor ||= create(:contractor, vendor: true) - dialpeer.account ||= create(:account, contractor: dialpeer.vendor) - dialpeer.gateway_group ||= create(:gateway_group, vendor: dialpeer.vendor) if dialpeer.gateway.blank? - end - end -end diff --git a/spec/factories/dialpeer_next_rate.rb b/spec/factories/dialpeer_next_rate.rb deleted file mode 100644 index 735fc75a6..000000000 --- a/spec/factories/dialpeer_next_rate.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :dialpeer_next_rate do - initial_rate { 0 } - next_rate { 0 } - initial_interval { 5 } - next_interval { 10 } - connect_fee { 0 } - apply_time { 1.hour.from_now } - applied { false } - - association :dialpeer - - trait :random do - initial_rate { 0.04 + rand.round(2) } - next_rate { 0.05 + rand.round(2) } - initial_interval { rand(90..149) } - next_interval { rand(120..179) } - connect_fee { 0.06 + rand.round(2) } - end - end -end diff --git a/spec/factories/dialpeer_next_rates.rb b/spec/factories/dialpeer_next_rates.rb new file mode 100644 index 000000000..93dbee2a0 --- /dev/null +++ b/spec/factories/dialpeer_next_rates.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: dialpeer_next_rates +# +# id :bigint(8) not null, primary key +# applied :boolean default(FALSE), not null +# apply_time :timestamptz not null +# connect_fee :decimal(, ) not null +# initial_interval :integer(2) not null +# initial_rate :decimal(, ) not null +# next_interval :integer(2) not null +# next_rate :decimal(, ) not null +# created_at :timestamptz not null +# updated_at :timestamptz +# dialpeer_id :bigint(8) not null +# external_id :bigint(8) +# +# Indexes +# +# dialpeer_next_rates_dialpeer_id_idx (dialpeer_id) +# +# Foreign Keys +# +# dialpeer_next_rates_dialpeer_id_fkey (dialpeer_id => dialpeers.id) +# +FactoryBot.define do + factory :dialpeer_next_rate do + initial_rate { 0 } + next_rate { 0 } + initial_interval { 5 } + next_interval { 10 } + connect_fee { 0 } + apply_time { 1.hour.from_now } + applied { false } + + association :dialpeer + + trait :random do + initial_rate { 0.04 + rand.round(2) } + next_rate { 0.05 + rand.round(2) } + initial_interval { rand(90..149) } + next_interval { rand(120..179) } + connect_fee { 0.06 + rand.round(2) } + end + end +end diff --git a/spec/factories/dialpeers.rb b/spec/factories/dialpeers.rb new file mode 100644 index 000000000..91b642046 --- /dev/null +++ b/spec/factories/dialpeers.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.dialpeers +# +# id :bigint(8) not null, primary key +# acd_limit :float default(0.0), not null +# asr_limit :float default(0.0), not null +# capacity :integer(2) +# connect_fee :decimal(, ) default(0.0), not null +# dst_number_max_length :integer(2) default(100), not null +# dst_number_min_length :integer(2) default(0), not null +# dst_rewrite_result :string +# dst_rewrite_rule :string +# enabled :boolean not null +# exclusive_route :boolean default(FALSE), not null +# force_hit_rate :float +# initial_interval :integer(4) default(1), not null +# initial_rate :decimal(, ) not null +# lcr_rate_multiplier :decimal(, ) default(1.0), not null +# locked :boolean default(FALSE), not null +# next_interval :integer(4) default(1), not null +# next_rate :decimal(, ) not null +# prefix :string not null +# priority :integer(4) default(100), not null +# reverse_billing :boolean default(FALSE), not null +# routing_tag_ids :integer(2) default([]), not null, is an Array +# short_calls_limit :float default(1.0), not null +# src_name_rewrite_result :string +# src_name_rewrite_rule :string +# src_rewrite_result :string +# src_rewrite_rule :string +# valid_from :timestamptz not null +# valid_till :timestamptz not null +# created_at :timestamptz not null +# account_id :integer(4) not null +# current_rate_id :bigint(8) +# external_id :bigint(8) +# gateway_group_id :integer(4) +# gateway_id :integer(4) +# network_prefix_id :integer(4) +# routeset_discriminator_id :integer(2) default(1), not null +# routing_group_id :integer(4) not null +# routing_tag_mode_id :integer(2) default(0), not null +# vendor_id :integer(4) not null +# +# Indexes +# +# dialpeers_account_id_idx (account_id) +# dialpeers_external_id_idx (external_id) +# dialpeers_prefix_range_idx (((prefix)::prefix_range)) USING gist +# dialpeers_prefix_range_valid_from_valid_till_idx (((prefix)::prefix_range), valid_from, valid_till) WHERE enabled USING gist +# dialpeers_prefix_range_valid_from_valid_till_idx1 (((prefix)::prefix_range), valid_from, valid_till) WHERE (enabled AND (NOT locked)) USING gist +# dialpeers_vendor_id_idx (vendor_id) +# +# Foreign Keys +# +# dialpeers_account_id_fkey (account_id => accounts.id) +# dialpeers_gateway_group_id_fkey (gateway_group_id => gateway_groups.id) +# dialpeers_gateway_id_fkey (gateway_id => gateways.id) +# dialpeers_routeset_discriminator_id_fkey (routeset_discriminator_id => routeset_discriminators.id) +# dialpeers_routing_group_id_fkey (routing_group_id => routing_groups.id) +# dialpeers_routing_tag_mode_id_fkey (routing_tag_mode_id => routing_tag_modes.id) +# dialpeers_vendor_id_fkey (vendor_id => contractors.id) +# +FactoryBot.define do + factory :dialpeer, class: Dialpeer do + sequence(:external_id) + enabled { true } + reverse_billing { false } + prefix { nil } + src_rewrite_rule { nil } + dst_rewrite_rule { nil } + acd_limit { 0 } + asr_limit { 0 } + gateway_id { nil } + routing_group_id { nil } + connect_fee { 0 } + src_rewrite_result { nil } + dst_rewrite_result { nil } + locked { false } + priority { 100 } + capacity { 1 } + lcr_rate_multiplier { 1 } + next_rate { 0.0 } + initial_rate { 0.0 } + next_interval { 60 } + initial_interval { 60 } + + valid_from { 10.days.ago.utc } + valid_till { 10.days.from_now.utc } + + association :routing_group + association :routeset_discriminator + + after :build do |dialpeer| + dialpeer.vendor ||= create(:contractor, vendor: true) + dialpeer.account ||= create(:account, contractor: dialpeer.vendor) + dialpeer.gateway_group ||= create(:gateway_group, vendor: dialpeer.vendor) if dialpeer.gateway.blank? + end + end +end diff --git a/spec/factories/disconnect_code.rb b/spec/factories/disconnect_codes.rb similarity index 97% rename from spec/factories/disconnect_code.rb rename to spec/factories/disconnect_codes.rb index f1b6bc056..27167e742 100644 --- a/spec/factories/disconnect_code.rb +++ b/spec/factories/disconnect_codes.rb @@ -2,7 +2,7 @@ # == Schema Information # -# Table name: disconnect_code +# Table name: class4.disconnect_code # # id :integer(4) not null, primary key # code :integer(4) not null diff --git a/spec/factories/equipment/cnam_database.rb b/spec/factories/equipment/cnam_database.rb deleted file mode 100644 index 197eae0be..000000000 --- a/spec/factories/equipment/cnam_database.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :cnam_database, class: Cnam::Database do - sequence(:name) { |n| "CNAM db script_#{n}" } - request_lua { 'arg.a="000"; table.insert(arg.v,9); return arg;' } - response_lua { 'arg.a="000"; table.insert(arg.v,9); return arg;' } - association :database, factory: :cnam_database_http - end -end diff --git a/spec/factories/equipment/cnam_database_http.rb b/spec/factories/equipment/cnam_database_http.rb deleted file mode 100644 index fc3d7181b..000000000 --- a/spec/factories/equipment/cnam_database_http.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :cnam_database_http, class: Cnam::DatabaseHttp do - url { 'https://example.com/{pai}' } - timeout { 15_000 } - end -end diff --git a/spec/factories/equipment/radius/accounting_profile.rb b/spec/factories/equipment/radius/accounting_profile.rb deleted file mode 100644 index 9b3a575a8..000000000 --- a/spec/factories/equipment/radius/accounting_profile.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :accounting_profile, class: Equipment::Radius::AccountingProfile do - sequence(:name) { |n| "profile#{n}" } - server { 'server' } - port { '1' } - secret { 'secret' } - timeout { 100 } - attempts { 2 } - - trait :filled do - after(:create) do |record| - FactoryBot.create_list(:gateway, 2, radius_accounting_profile: record) - FactoryBot.create_list(:accounting_profile_stop_attribute, 2, profile: record) - FactoryBot.create_list(:accounting_profile_start_attribute, 2, profile: record) - FactoryBot.create_list(:customers_auth, 2, radius_accounting_profile: record) - end - end - end -end diff --git a/spec/factories/equipment/radius/accounting_profile_start_attribute.rb b/spec/factories/equipment/radius/accounting_profile_start_attributes.rb similarity index 66% rename from spec/factories/equipment/radius/accounting_profile_start_attribute.rb rename to spec/factories/equipment/radius/accounting_profile_start_attributes.rb index f6bd37763..fbb856f4b 100644 --- a/spec/factories/equipment/radius/accounting_profile_start_attribute.rb +++ b/spec/factories/equipment/radius/accounting_profile_start_attributes.rb @@ -4,15 +4,19 @@ # # Table name: class4.radius_accounting_profile_start_attributes # -# id :integer not null, primary key -# profile_id :integer not null -# type_id :integer not null -# name :string not null -# value :string not null +# id :integer(2) not null, primary key # format :string not null # is_vsa :boolean default(FALSE), not null -# vsa_vendor_id :integer -# vsa_vendor_type :integer +# name :string not null +# value :string not null +# vsa_vendor_type :integer(2) +# profile_id :integer(2) not null +# type_id :integer(2) not null +# vsa_vendor_id :integer(4) +# +# Foreign Keys +# +# radius_accounting_profile_start_attributes_profile_id_fkey (profile_id => radius_accounting_profiles.id) # FactoryBot.define do diff --git a/spec/factories/equipment/radius/accounting_profile_stop_attribute.rb b/spec/factories/equipment/radius/accounting_profile_stop_attributes.rb similarity index 66% rename from spec/factories/equipment/radius/accounting_profile_stop_attribute.rb rename to spec/factories/equipment/radius/accounting_profile_stop_attributes.rb index e0e8aaa60..a4c99d675 100644 --- a/spec/factories/equipment/radius/accounting_profile_stop_attribute.rb +++ b/spec/factories/equipment/radius/accounting_profile_stop_attributes.rb @@ -4,15 +4,19 @@ # # Table name: class4.radius_accounting_profile_stop_attributes # -# id :integer not null, primary key -# profile_id :integer not null -# type_id :integer not null -# name :string not null -# value :string not null +# id :integer(2) not null, primary key # format :string not null # is_vsa :boolean default(FALSE), not null -# vsa_vendor_id :integer -# vsa_vendor_type :integer +# name :string not null +# value :string not null +# vsa_vendor_type :integer(2) +# profile_id :integer(2) not null +# type_id :integer(2) not null +# vsa_vendor_id :integer(4) +# +# Foreign Keys +# +# radius_accounting_profile_stop_attributes_profile_id_fkey (profile_id => radius_accounting_profiles.id) # FactoryBot.define do diff --git a/spec/factories/equipment/radius/accounting_profiles.rb b/spec/factories/equipment/radius/accounting_profiles.rb new file mode 100644 index 000000000..d3c790eff --- /dev/null +++ b/spec/factories/equipment/radius/accounting_profiles.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.radius_accounting_profiles +# +# id :integer(2) not null, primary key +# attempts :integer(2) default(2), not null +# enable_interim_accounting :boolean default(FALSE), not null +# enable_start_accounting :boolean default(FALSE), not null +# enable_stop_accounting :boolean default(TRUE), not null +# interim_accounting_interval :integer(2) default(30), not null +# name :string not null +# port :integer(4) not null +# secret :string not null +# server :string not null +# timeout :integer(2) default(100), not null +# +# Indexes +# +# radius_accounting_profiles_name_key (name) UNIQUE +# +FactoryBot.define do + factory :accounting_profile, class: Equipment::Radius::AccountingProfile do + sequence(:name) { |n| "profile#{n}" } + server { 'server' } + port { '1' } + secret { 'secret' } + timeout { 100 } + attempts { 2 } + + trait :filled do + after(:create) do |record| + FactoryBot.create_list(:gateway, 2, radius_accounting_profile: record) + FactoryBot.create_list(:accounting_profile_stop_attribute, 2, profile: record) + FactoryBot.create_list(:accounting_profile_start_attribute, 2, profile: record) + FactoryBot.create_list(:customers_auth, 2, radius_accounting_profile: record) + end + end + end +end diff --git a/spec/factories/equipment/radius/auth_profile.rb b/spec/factories/equipment/radius/auth_profile.rb deleted file mode 100644 index 7e9fe02b1..000000000 --- a/spec/factories/equipment/radius/auth_profile.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :auth_profile, class: Equipment::Radius::AuthProfile do - sequence(:name) { |n| "auth_profile#{n}" } - server { 'server' } - port { '1' } - secret { 'secret' } - timeout { 100 } - attempts { 2 } - - trait :filled do - after(:create) do |record| - create_list(:customers_auth, 2, radius_auth_profile: record) - end - end - end -end diff --git a/spec/factories/equipment/radius/auth_profiles.rb b/spec/factories/equipment/radius/auth_profiles.rb new file mode 100644 index 000000000..7cd55f00e --- /dev/null +++ b/spec/factories/equipment/radius/auth_profiles.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.radius_auth_profiles +# +# id :integer(2) not null, primary key +# attempts :integer(2) default(2), not null +# name :string not null +# port :integer(4) not null +# reject_on_error :boolean default(TRUE), not null +# secret :string not null +# server :string not null +# timeout :integer(2) default(100), not null +# +# Indexes +# +# radius_auth_profiles_name_key (name) UNIQUE +# +FactoryBot.define do + factory :auth_profile, class: Equipment::Radius::AuthProfile do + sequence(:name) { |n| "auth_profile#{n}" } + server { 'server' } + port { '1' } + secret { 'secret' } + timeout { 100 } + attempts { 2 } + + trait :filled do + after(:create) do |record| + create_list(:customers_auth, 2, radius_auth_profile: record) + end + end + end +end diff --git a/spec/factories/equipment/registrations.rb b/spec/factories/equipment/registrations.rb new file mode 100644 index 000000000..b2d465fe4 --- /dev/null +++ b/spec/factories/equipment/registrations.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.registrations +# +# id :integer(4) not null, primary key +# auth_password :string +# auth_user :string +# contact :string +# display_username :string +# domain :string +# enabled :boolean default(TRUE), not null +# expire :integer(4) +# force_expire :boolean default(FALSE), not null +# max_attempts :integer(2) +# name :string not null +# proxy :string +# retry_delay :integer(2) default(5), not null +# sip_interface_name :string +# username :string not null +# node_id :integer(4) +# pop_id :integer(4) +# proxy_transport_protocol_id :integer(2) default(1), not null +# sip_schema_id :integer(2) default(1), not null +# transport_protocol_id :integer(2) default(1), not null +# +# Indexes +# +# registrations_name_key (name) UNIQUE +# +# Foreign Keys +# +# registrations_node_id_fkey (node_id => nodes.id) +# registrations_pop_id_fkey (pop_id => pops.id) +# registrations_proxy_transport_protocol_id_fkey (proxy_transport_protocol_id => transport_protocols.id) +# registrations_transport_protocol_id_fkey (transport_protocol_id => transport_protocols.id) +# +FactoryBot.define do + factory :registration, class: Equipment::Registration do + sequence(:name) { |n| "Equipment Registration #{n}" } + domain { 'localhost' } + username { 'user name' } + contact { 'sip:user@domain' } + sip_schema_id { 1 } + + trait :filled do + node + pop + transport_protocol { Equipment::TransportProtocol.take } + proxy_transport_protocol { Equipment::TransportProtocol.take } + sequence(:sip_interface_name) { |n| "interface_#{n}" } + end + end +end diff --git a/spec/factories/equipment/stir_shaken_signing_certificate.rb b/spec/factories/equipment/stir_shaken/signing_certificates.rb similarity index 59% rename from spec/factories/equipment/stir_shaken_signing_certificate.rb rename to spec/factories/equipment/stir_shaken/signing_certificates.rb index bca04cd7e..b31c256e1 100644 --- a/spec/factories/equipment/stir_shaken_signing_certificate.rb +++ b/spec/factories/equipment/stir_shaken/signing_certificates.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: class4.stir_shaken_signing_certificates +# +# id :integer(2) not null, primary key +# certificate :string not null +# key :string not null +# name :string not null +# x5u :string not null +# updated_at :timestamptz +# FactoryBot.define do factory :stir_shaken_signing_certificate, class: Equipment::StirShaken::SigningCertificate do sequence(:name) { |n| "test_#{n}" } diff --git a/spec/factories/equipment/stir_shaken_trusted_certificate.rb b/spec/factories/equipment/stir_shaken/trusted_certificates.rb similarity index 57% rename from spec/factories/equipment/stir_shaken_trusted_certificate.rb rename to spec/factories/equipment/stir_shaken/trusted_certificates.rb index 1617e16ad..5c6131e8a 100644 --- a/spec/factories/equipment/stir_shaken_trusted_certificate.rb +++ b/spec/factories/equipment/stir_shaken/trusted_certificates.rb @@ -1,5 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: class4.stir_shaken_trusted_certificates +# +# id :integer(2) not null, primary key +# certificate :string not null +# name :string not null +# updated_at :timestamptz +# FactoryBot.define do factory :stir_shaken_trusted_certificate, class: Equipment::StirShaken::TrustedCertificate do sequence(:name) { |n| "test_#{n}" } diff --git a/spec/factories/equipment/stir_shaken/trusted_repositories.rb b/spec/factories/equipment/stir_shaken/trusted_repositories.rb new file mode 100644 index 000000000..4ac957b00 --- /dev/null +++ b/spec/factories/equipment/stir_shaken/trusted_repositories.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: stir_shaken_trusted_repositories +# +# id :integer(2) not null, primary key +# url_pattern :string not null +# validate_https_certificate :boolean default(TRUE), not null +# updated_at :timestamptz +# +FactoryBot.define do + factory :stir_shaken_trusted_repository, class: Equipment::StirShaken::TrustedRepository do + sequence(:url_pattern) { |n| "https://test_#{n}" } + validate_https_certificate { true } + updated_at { Time.now.utc.change(usec: 0) } + end +end diff --git a/spec/factories/equipment/stir_shaken_trusted_repository.rb b/spec/factories/equipment/stir_shaken_trusted_repository.rb deleted file mode 100644 index d7d92e622..000000000 --- a/spec/factories/equipment/stir_shaken_trusted_repository.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :stir_shaken_trusted_repository, class: Equipment::StirShaken::TrustedRepository do - sequence(:url_pattern) { |n| "https://test_#{n}" } - validate_https_certificate { true } - updated_at { Time.now.utc.change(usec: 0) } - end -end diff --git a/spec/factories/log/event.rb b/spec/factories/events.rb similarity index 59% rename from spec/factories/log/event.rb rename to spec/factories/events.rb index 1e66b9c53..71973e483 100644 --- a/spec/factories/log/event.rb +++ b/spec/factories/events.rb @@ -4,13 +4,17 @@ # # Table name: events # -# id :integer not null, primary key +# id :integer(4) not null, primary key # command :string not null -# retries :integer default(0), not null -# node_id :integer not null -# created_at :datetime not null -# updated_at :datetime # last_error :string +# retries :integer(4) default(0), not null +# created_at :timestamptz not null +# updated_at :timestamptz +# node_id :integer(4) not null +# +# Foreign Keys +# +# events_node_id_fkey (node_id => nodes.id) # FactoryBot.define do diff --git a/spec/factories/gateway.rb b/spec/factories/gateway.rb deleted file mode 100644 index f024dedc0..000000000 --- a/spec/factories/gateway.rb +++ /dev/null @@ -1,139 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :gateway, class: Gateway do - sequence(:name) { |n| "gateway#{n}" } - enabled { true } - priority { 122 } - weight { 220 } - acd_limit { 0.0 } - asr_limit { 0.0 } - sdp_alines_filter_type_id { 0 } - session_refresh_method_id { 1 } - sdp_c_location_id { 2 } - sensor_level_id { 1 } - dtmf_receive_mode_id { 1 } - dtmf_send_mode_id { 1 } - rel100_mode_id { 1 } - - network_protocol_priority_id { 1 } - - transport_protocol_id { 1 } - term_proxy_transport_protocol_id { 1 } - orig_proxy_transport_protocol_id { 1 } - sip_schema_id { 1 } - host { 'test.example.com' } - port { nil } - registered_aor_mode_id { 1 } - src_rewrite_rule { nil } - dst_rewrite_rule { nil } - auth_enabled { false } - auth_user { nil } - auth_password { nil } - term_outbound_proxy { nil } - term_next_hop_for_replies { false } - term_use_outbound_proxy { false } - termination_capacity { 1 } - allow_termination { true } - allow_origination { true } - proxy_media { true } - origination_capacity { 1 } - preserve_anonymous_from_domain { false } - sst_enabled { false } - sst_minimum_timer { 50 } - sst_maximum_timer { 50 } - sst_accept501 { true } - sst_session_expires { 50 } - term_force_outbound_proxy { false } - locked { false } - codecs_payload_order { '' } - codecs_prefer_transcoding_for { nil } - src_rewrite_result { nil } - dst_rewrite_result { nil } - term_next_hop { nil } - orig_next_hop { nil } - orig_append_headers_req { nil } - term_append_headers_req { nil } - dialog_nat_handling { true } - orig_force_outbound_proxy { false } - orig_use_outbound_proxy { false } - orig_outbound_proxy { nil } - prefer_existing_codecs { true } - force_symmetric_rtp { true } - transparent_dialog_id { false } - sdp_alines_filter_list { nil } - gateway_group_id { nil } - orig_disconnect_policy_id { nil } - term_disconnect_policy_id { nil } - diversion_send_mode_id { 1 } - diversion_domain { nil } - diversion_rewrite_rule { nil } - diversion_rewrite_result { nil } - src_name_rewrite_rule { nil } - src_name_rewrite_result { nil } - pop_id { nil } - single_codec_in_200ok { false } - ringing_timeout { nil } - symmetric_rtp_nonstop { false } - resolve_ruri { false } - force_dtmf_relay { false } - relay_options { false } - rtp_ping { false } - relay_reinvite { false } - auth_from_user { nil } - auth_from_domain { nil } - relay_hold { false } - rtp_timeout { 30 } - relay_prack { false } - rtp_relay_timestamp_aligning { false } - allow_1xx_without_to_tag { false } - sip_timer_b { 8000 } - dns_srv_failover_timer { 2000 } - rtp_force_relay_cn { true } - sensor_id { nil } - filter_noaudio_streams { false } - media_encryption_mode_id { 1 } - force_cancel_routeset { false } - - association :contractor, factory: :contractor, vendor: true - codec_group { CodecGroup.take || association(:codec_group) } - - trait :with_incoming_auth do - incoming_auth_username { 'incoming_username' } - incoming_auth_password { 'incoming_password' } - end - - trait :without_incoming_auth do - incoming_auth_username { nil } - incoming_auth_password { nil } - end - - trait :filled do - session_refresh_method { SessionRefreshMethod.take } - sdp_alines_filter_type { FilterType.take } - orig_disconnect_policy { DisconnectPolicy.take || build(:disconnect_policy) } - term_disconnect_policy { DisconnectPolicy.take || build(:disconnect_policy) } - diversion_send_mode { Equipment::GatewayDiversionSendMode.take } - sdp_c_location { SdpCLocation.take } - sensor - sensor_level { System::SensorLevel.take } - dtmf_receive_mode { System::DtmfReceiveMode.take } - dtmf_send_mode { System::DtmfSendMode.take } - radius_accounting_profile { build :accounting_profile } - transport_protocol { Equipment::TransportProtocol.take } - term_proxy_transport_protocol { Equipment::TransportProtocol.take } - rel100_mode { Equipment::GatewayRel100Mode.take } - rx_inband_dtmf_filtering_mode { Equipment::GatewayInbandDtmfFilteringMode.take } - network_protocol_priority { Equipment::GatewayNetworkProtocolPriority.take } - media_encryption_mode { Equipment::GatewayMediaEncryptionMode.take } - termination_dst_numberlist { build :numberlist } - lua_script - statistic { build :gateways_stat } - - after(:create) do |record| - FactoryBot.create_list(:customers_auth, 2, gateway: record) - FactoryBot.create_list(:quality_stat, 2, gateway: record) - end - end - end -end diff --git a/spec/factories/gateway_group.rb b/spec/factories/gateway_group.rb deleted file mode 100644 index 53e098879..000000000 --- a/spec/factories/gateway_group.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :gateway_group, class: GatewayGroup do - sequence(:name) { |n| "gateway_group_#{n}" } - balancing_mode_id { 2 } - association :vendor, factory: :contractor, vendor: true - end -end diff --git a/spec/factories/gateway_groups.rb b/spec/factories/gateway_groups.rb new file mode 100644 index 000000000..46d537d6b --- /dev/null +++ b/spec/factories/gateway_groups.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: gateway_groups +# +# id :integer(4) not null, primary key +# name :string not null +# prefer_same_pop :boolean default(TRUE), not null +# balancing_mode_id :integer(2) default(1), not null +# vendor_id :integer(4) not null +# +# Indexes +# +# gateway_groups_name_key (name) UNIQUE +# gateway_groups_vendor_id_idx (vendor_id) +# +# Foreign Keys +# +# gateway_groups_balancing_mode_id_fkey (balancing_mode_id => gateway_group_balancing_modes.id) +# gateway_groups_contractor_id_fkey (vendor_id => contractors.id) +# +FactoryBot.define do + factory :gateway_group, class: GatewayGroup do + sequence(:name) { |n| "gateway_group_#{n}" } + balancing_mode_id { 2 } + association :vendor, factory: :contractor, vendor: true + end +end diff --git a/spec/factories/gateways.rb b/spec/factories/gateways.rb new file mode 100644 index 000000000..521badd43 --- /dev/null +++ b/spec/factories/gateways.rb @@ -0,0 +1,304 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.gateways +# +# id :integer(4) not null, primary key +# acd_limit :float default(0.0), not null +# allow_1xx_without_to_tag :boolean default(FALSE), not null +# allow_origination :boolean default(TRUE), not null +# allow_termination :boolean default(TRUE), not null +# asr_limit :float default(0.0), not null +# auth_enabled :boolean default(FALSE), not null +# auth_from_domain :string +# auth_from_user :string +# auth_password :string +# auth_user :string +# codecs_payload_order :string default("") +# codecs_prefer_transcoding_for :string default("") +# dialog_nat_handling :boolean default(TRUE), not null +# diversion_domain :string +# diversion_rewrite_result :string +# diversion_rewrite_rule :string +# dns_srv_failover_timer :integer(4) default(2000), not null +# dst_rewrite_result :string +# dst_rewrite_rule :string +# enabled :boolean not null +# fake_180_timer :integer(2) +# filter_noaudio_streams :boolean default(FALSE), not null +# force_cancel_routeset :boolean default(FALSE), not null +# force_dtmf_relay :boolean default(FALSE), not null +# force_one_way_early_media :boolean default(FALSE), not null +# force_symmetric_rtp :boolean default(TRUE), not null +# host :string +# incoming_auth_password :string +# incoming_auth_username :string +# is_shared :boolean default(FALSE), not null +# locked :boolean default(FALSE), not null +# max_30x_redirects :integer(2) default(0), not null +# max_transfers :integer(2) default(0), not null +# name :string not null +# orig_append_headers_reply :string is an Array +# orig_append_headers_req :string +# orig_force_outbound_proxy :boolean default(FALSE), not null +# orig_next_hop :string +# orig_outbound_proxy :string +# orig_use_outbound_proxy :boolean default(FALSE), not null +# origination_capacity :integer(2) +# pai_domain :string +# port :integer(4) +# prefer_existing_codecs :boolean default(TRUE), not null +# preserve_anonymous_from_domain :boolean default(FALSE), not null +# priority :integer(4) default(100), not null +# proxy_media :boolean default(TRUE), not null +# relay_hold :boolean default(FALSE), not null +# relay_options :boolean default(FALSE), not null +# relay_prack :boolean default(FALSE), not null +# relay_reinvite :boolean default(FALSE), not null +# relay_update :boolean default(FALSE), not null +# resolve_ruri :boolean default(FALSE), not null +# ringing_timeout :integer(4) +# rtp_acl :inet is an Array +# rtp_force_relay_cn :boolean default(TRUE), not null +# rtp_interface_name :string +# rtp_ping :boolean default(FALSE), not null +# rtp_relay_timestamp_aligning :boolean default(FALSE), not null +# rtp_timeout :integer(4) default(30), not null +# sdp_alines_filter_list :string +# send_lnp_information :boolean default(FALSE), not null +# short_calls_limit :float default(1.0), not null +# single_codec_in_200ok :boolean default(FALSE), not null +# sip_interface_name :string +# sip_timer_b :integer(4) default(8000), not null +# src_name_rewrite_result :string +# src_name_rewrite_rule :string +# src_rewrite_result :string +# src_rewrite_rule :string +# sst_accept501 :boolean default(TRUE), not null +# sst_enabled :boolean default(FALSE) +# sst_maximum_timer :integer(4) default(50), not null +# sst_minimum_timer :integer(4) default(50), not null +# sst_session_expires :integer(4) default(50) +# suppress_early_media :boolean default(FALSE), not null +# symmetric_rtp_nonstop :boolean default(FALSE), not null +# term_append_headers_req :string +# term_force_outbound_proxy :boolean default(FALSE), not null +# term_next_hop :string +# term_next_hop_for_replies :boolean default(FALSE), not null +# term_outbound_proxy :string +# term_use_outbound_proxy :boolean default(FALSE), not null +# termination_capacity :integer(2) +# to_rewrite_result :string +# to_rewrite_rule :string +# transit_headers_from_origination :string +# transit_headers_from_termination :string +# try_avoid_transcoding :boolean default(FALSE), not null +# weight :integer(2) default(100), not null +# codec_group_id :integer(4) default(1), not null +# contractor_id :integer(4) not null +# diversion_send_mode_id :integer(2) default(1), not null +# dtmf_receive_mode_id :integer(2) default(1), not null +# dtmf_send_mode_id :integer(2) default(1), not null +# external_id :bigint(8) +# gateway_group_id :integer(4) +# lua_script_id :integer(2) +# media_encryption_mode_id :integer(2) default(0), not null +# network_protocol_priority_id :integer(2) default(0), not null +# orig_disconnect_policy_id :integer(4) +# orig_proxy_transport_protocol_id :integer(2) default(1), not null +# pai_send_mode_id :integer(2) default(0), not null +# pop_id :integer(4) +# privacy_mode_id :integer(2) default(0), not null +# radius_accounting_profile_id :integer(2) +# registered_aor_mode_id :integer(2) default(0), not null +# rel100_mode_id :integer(2) default(4), not null +# rx_inband_dtmf_filtering_mode_id :integer(2) default(1), not null +# sdp_alines_filter_type_id :integer(4) default(0), not null +# sdp_c_location_id :integer(4) default(2), not null +# sensor_id :integer(2) +# sensor_level_id :integer(2) default(1), not null +# session_refresh_method_id :integer(4) default(3), not null +# sip_schema_id :integer(2) default(1), not null +# stir_shaken_crt_id :integer(2) +# stir_shaken_mode_id :integer(2) default(0), not null +# term_disconnect_policy_id :integer(4) +# term_proxy_transport_protocol_id :integer(2) default(1), not null +# termination_dst_numberlist_id :integer(2) +# termination_src_numberlist_id :integer(2) +# transparent_dialog_id :boolean default(FALSE), not null +# transport_protocol_id :integer(2) default(1), not null +# tx_inband_dtmf_filtering_mode_id :integer(2) default(1), not null +# +# Indexes +# +# gateways_contractor_id_idx (contractor_id) +# gateways_dst_numberlist_id_idx (termination_dst_numberlist_id) +# gateways_name_unique (name) UNIQUE +# gateways_src_numberlist_id_idx (termination_src_numberlist_id) +# +# Foreign Keys +# +# gateways_codec_group_id_fkey (codec_group_id => codec_groups.id) +# gateways_contractor_id_fkey (contractor_id => contractors.id) +# gateways_diversion_send_mode_id_fkey (diversion_send_mode_id => gateway_diversion_send_modes.id) +# gateways_dtmf_receive_mode_id_fkey (dtmf_receive_mode_id => dtmf_receive_modes.id) +# gateways_dtmf_send_mode_id_fkey (dtmf_send_mode_id => dtmf_send_modes.id) +# gateways_gateway_group_id_fkey (gateway_group_id => gateway_groups.id) +# gateways_lua_script_id_fkey (lua_script_id => lua_scripts.id) +# gateways_media_encryption_mode_id_fkey (media_encryption_mode_id => gateway_media_encryption_modes.id) +# gateways_network_protocol_priority_id_fkey (network_protocol_priority_id => gateway_network_protocol_priorities.id) +# gateways_orig_disconnect_policy_id_fkey (orig_disconnect_policy_id => disconnect_policy.id) +# gateways_orig_proxy_transport_protocol_id_fkey (orig_proxy_transport_protocol_id => transport_protocols.id) +# gateways_pop_id_fkey (pop_id => pops.id) +# gateways_radius_accounting_profile_id_fkey (radius_accounting_profile_id => radius_accounting_profiles.id) +# gateways_rel100_mode_id_fkey (rel100_mode_id => gateway_rel100_modes.id) +# gateways_rx_inband_dtmf_filtering_mode_id_fkey (rx_inband_dtmf_filtering_mode_id => gateway_inband_dtmf_filtering_modes.id) +# gateways_sdp_alines_filter_type_id_fkey (sdp_alines_filter_type_id => filter_types.id) +# gateways_sdp_c_location_id_fkey (sdp_c_location_id => sdp_c_location.id) +# gateways_sensor_id_fkey (sensor_id => sensors.id) +# gateways_sensor_level_id_fkey (sensor_level_id => sensor_levels.id) +# gateways_session_refresh_method_id_fkey (session_refresh_method_id => session_refresh_methods.id) +# gateways_stir_shaken_crt_id_fkey (stir_shaken_crt_id => stir_shaken_signing_certificates.id) +# gateways_term_disconnect_policy_id_fkey (term_disconnect_policy_id => disconnect_policy.id) +# gateways_term_proxy_transport_protocol_id_fkey (term_proxy_transport_protocol_id => transport_protocols.id) +# gateways_transport_protocol_id_fkey (transport_protocol_id => transport_protocols.id) +# gateways_tx_inband_dtmf_filtering_mode_id_fkey (tx_inband_dtmf_filtering_mode_id => gateway_inband_dtmf_filtering_modes.id) +# +FactoryBot.define do + factory :gateway, class: Gateway do + sequence(:name) { |n| "gateway#{n}" } + enabled { true } + priority { 122 } + weight { 220 } + acd_limit { 0.0 } + asr_limit { 0.0 } + sdp_alines_filter_type_id { 0 } + session_refresh_method_id { 1 } + sdp_c_location_id { 2 } + sensor_level_id { 1 } + dtmf_receive_mode_id { 1 } + dtmf_send_mode_id { 1 } + rel100_mode_id { 1 } + + network_protocol_priority_id { 1 } + + transport_protocol_id { 1 } + term_proxy_transport_protocol_id { 1 } + orig_proxy_transport_protocol_id { 1 } + sip_schema_id { 1 } + host { 'test.example.com' } + port { nil } + registered_aor_mode_id { 1 } + src_rewrite_rule { nil } + dst_rewrite_rule { nil } + auth_enabled { false } + auth_user { nil } + auth_password { nil } + term_outbound_proxy { nil } + term_next_hop_for_replies { false } + term_use_outbound_proxy { false } + termination_capacity { 1 } + allow_termination { true } + allow_origination { true } + proxy_media { true } + origination_capacity { 1 } + preserve_anonymous_from_domain { false } + sst_enabled { false } + sst_minimum_timer { 50 } + sst_maximum_timer { 50 } + sst_accept501 { true } + sst_session_expires { 50 } + term_force_outbound_proxy { false } + locked { false } + codecs_payload_order { '' } + codecs_prefer_transcoding_for { nil } + src_rewrite_result { nil } + dst_rewrite_result { nil } + term_next_hop { nil } + orig_next_hop { nil } + orig_append_headers_req { nil } + term_append_headers_req { nil } + dialog_nat_handling { true } + orig_force_outbound_proxy { false } + orig_use_outbound_proxy { false } + orig_outbound_proxy { nil } + prefer_existing_codecs { true } + force_symmetric_rtp { true } + transparent_dialog_id { false } + sdp_alines_filter_list { nil } + gateway_group_id { nil } + orig_disconnect_policy_id { nil } + term_disconnect_policy_id { nil } + diversion_send_mode_id { 1 } + diversion_domain { nil } + diversion_rewrite_rule { nil } + diversion_rewrite_result { nil } + src_name_rewrite_rule { nil } + src_name_rewrite_result { nil } + pop_id { nil } + single_codec_in_200ok { false } + ringing_timeout { nil } + symmetric_rtp_nonstop { false } + resolve_ruri { false } + force_dtmf_relay { false } + relay_options { false } + rtp_ping { false } + relay_reinvite { false } + auth_from_user { nil } + auth_from_domain { nil } + relay_hold { false } + rtp_timeout { 30 } + relay_prack { false } + rtp_relay_timestamp_aligning { false } + allow_1xx_without_to_tag { false } + sip_timer_b { 8000 } + dns_srv_failover_timer { 2000 } + rtp_force_relay_cn { true } + sensor_id { nil } + filter_noaudio_streams { false } + media_encryption_mode_id { 1 } + force_cancel_routeset { false } + + association :contractor, factory: :contractor, vendor: true + codec_group { CodecGroup.take || association(:codec_group) } + + trait :with_incoming_auth do + incoming_auth_username { 'incoming_username' } + incoming_auth_password { 'incoming_password' } + end + + trait :without_incoming_auth do + incoming_auth_username { nil } + incoming_auth_password { nil } + end + + trait :filled do + session_refresh_method { SessionRefreshMethod.take } + sdp_alines_filter_type { FilterType.take } + orig_disconnect_policy { DisconnectPolicy.take || build(:disconnect_policy) } + term_disconnect_policy { DisconnectPolicy.take || build(:disconnect_policy) } + diversion_send_mode { Equipment::GatewayDiversionSendMode.take } + sdp_c_location { SdpCLocation.take } + sensor + sensor_level { System::SensorLevel.take } + dtmf_receive_mode { System::DtmfReceiveMode.take } + dtmf_send_mode { System::DtmfSendMode.take } + radius_accounting_profile { build :accounting_profile } + transport_protocol { Equipment::TransportProtocol.take } + term_proxy_transport_protocol { Equipment::TransportProtocol.take } + rel100_mode { Equipment::GatewayRel100Mode.take } + rx_inband_dtmf_filtering_mode { Equipment::GatewayInbandDtmfFilteringMode.take } + network_protocol_priority { Equipment::GatewayNetworkProtocolPriority.take } + media_encryption_mode { Equipment::GatewayMediaEncryptionMode.take } + termination_dst_numberlist { build :numberlist } + lua_script + statistic { build :gateways_stat } + + after(:create) do |record| + FactoryBot.create_list(:customers_auth, 2, gateway: record) + FactoryBot.create_list(:quality_stat, 2, gateway: record) + end + end + end +end diff --git a/spec/factories/gateways_stat.rb b/spec/factories/gateways_stat.rb deleted file mode 100644 index ef901d5ad..000000000 --- a/spec/factories/gateways_stat.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: gateways_stats -# -# id :integer not null, primary key -# gateway_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# calls :integer not null -# calls_success :integer not null -# calls_fail :integer not null -# total_duration :integer not null -# asr :float -# acd :float -# locked_at :datetime -# unlocked_at :datetime -# - -FactoryBot.define do - factory :gateways_stat, class: GatewaysStat do - gateway - created_at { Time.now.utc } - updated_at { 1.hour.ago.utc } - calls { 6 } - calls_success { 5 } - calls_fail { 1 } - total_duration { 200 } - end -end diff --git a/spec/factories/gateways_stats.rb b/spec/factories/gateways_stats.rb new file mode 100644 index 000000000..b1a76cf83 --- /dev/null +++ b/spec/factories/gateways_stats.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: gateways_stats +# +# id :integer(4) not null, primary key +# acd :float +# asr :float +# calls :bigint(8) not null +# calls_fail :bigint(8) not null +# calls_success :bigint(8) not null +# locked_at :timestamptz +# total_duration :bigint(8) not null +# unlocked_at :timestamptz +# created_at :timestamptz not null +# updated_at :timestamptz not null +# gateway_id :integer(4) not null +# +# Indexes +# +# unique_gw (gateway_id) UNIQUE +# +FactoryBot.define do + factory :gateways_stat, class: GatewaysStat do + gateway + created_at { Time.now.utc } + updated_at { 1.hour.ago.utc } + calls { 6 } + calls_success { 5 } + calls_fail { 1 } + total_duration { 200 } + end +end diff --git a/spec/factories/importing/accounts.rb b/spec/factories/importing/accounts.rb new file mode 100644 index 000000000..cbbc9ee3f --- /dev/null +++ b/spec/factories/importing/accounts.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_accounts +# +# id :bigint(8) not null, primary key +# autogenerate_customer_invoices :boolean default(FALSE), not null +# autogenerate_vendor_invoices :boolean default(FALSE), not null +# balance :decimal(, ) +# contractor_name :string +# destination_rate_limit :decimal(, ) +# error_string :string +# invoice_period_name :string +# is_changed :boolean +# max_balance :decimal(, ) +# max_call_duration :integer(4) +# min_balance :decimal(, ) +# name :string +# origination_capacity :integer(4) +# termination_capacity :integer(4) +# total_capacity :integer(2) +# vat :decimal(, ) +# contractor_id :integer(4) +# invoice_period_id :integer(2) +# o_id :integer(4) +# +FactoryBot.define do + factory :importing_account, class: Importing::Account do + o_id { nil } + name { nil } + contractor_name { nil } + contractor_id { nil } + balance { 0 } + vat { 18.2 } + min_balance { 0 } + max_balance { 0 } + destination_rate_limit { 0.332 } + max_call_duration { 18_000 } + origination_capacity { 1 } + termination_capacity { 1 } + total_capacity { 3 } + error_string { nil } + end +end diff --git a/spec/factories/importing/contractors.rb b/spec/factories/importing/contractors.rb new file mode 100644 index 000000000..0a4327c62 --- /dev/null +++ b/spec/factories/importing/contractors.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_contractors +# +# id :bigint(8) not null, primary key +# address :string +# customer :boolean +# description :string +# enabled :boolean +# error_string :string +# is_changed :boolean +# name :string +# phones :string +# smtp_connection_name :string +# vendor :boolean +# o_id :integer(4) +# smtp_connection_id :integer(4) +# +FactoryBot.define do + factory :importing_contractor, class: Importing::Contractor do + o_id { nil } + error_string { nil } + + name { nil } + enabled { true } + vendor { false } + customer { false } + + smtp_connection_name do + System::SmtpConnection.take.try(:name) || create(:smtp_connection).name + end + end +end diff --git a/spec/factories/importing/customers_auths.rb b/spec/factories/importing/customers_auths.rb new file mode 100644 index 000000000..e1cb8e130 --- /dev/null +++ b/spec/factories/importing/customers_auths.rb @@ -0,0 +1,152 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_customers_auth +# +# id :bigint(8) not null, primary key +# account_name :string +# allow_receive_rate_limit :boolean default(FALSE), not null +# capacity :integer(4) +# check_account_balance :boolean +# cps_limit :float +# customer_name :string +# diversion_policy_name :string +# diversion_rewrite_result :string +# diversion_rewrite_rule :string +# dst_number_field_name :integer(2) +# dst_number_max_length :integer(4) +# dst_number_min_length :integer(4) +# dst_number_radius_rewrite_result :string +# dst_number_radius_rewrite_rule :string +# dst_numberlist_name :string +# dst_prefix :string +# dst_rewrite_result :string +# dst_rewrite_rule :string +# dump_level_name :string +# enable_audio_recording :boolean +# enabled :boolean +# error_string :string +# from_domain :string +# gateway_name :string +# ip :string +# is_changed :boolean +# lua_script_name :string +# max_dst_number_length :integer(2) +# min_dst_number_length :integer(2) +# name :string +# pop_name :string +# radius_accounting_profile_name :string +# radius_auth_profile_name :string +# rateplan_name :string +# reject_calls :boolean +# require_incoming_auth :boolean +# routing_group_name :string +# routing_plan_name :string +# send_billing_information :boolean default(FALSE), not null +# src_name_field_name :integer(2) +# src_name_rewrite_result :string +# src_name_rewrite_rule :string +# src_number_field_name :string +# src_number_max_length :integer(2) +# src_number_min_length :integer(2) +# src_number_radius_rewrite_result :string +# src_number_radius_rewrite_rule :string +# src_numberlist_name :string +# src_prefix :string +# src_rewrite_result :string +# src_rewrite_rule :string +# tag_action_name :string +# tag_action_value :integer(2) default([]), not null, is an Array +# tag_action_value_names :string +# to_domain :string +# transport_protocol_name :string +# uri_domain :string +# x_yeti_auth :string +# account_id :integer(4) +# customer_id :integer(4) +# diversion_policy_id :integer(4) +# dst_number_field_id :integer(2) +# dst_numberlist_id :integer(4) +# dump_level_id :integer(4) +# gateway_id :integer(4) +# lua_script_id :integer(2) +# o_id :bigint(8) +# pop_id :integer(4) +# radius_accounting_profile_id :integer(2) +# radius_auth_profile_id :integer(2) +# rateplan_id :integer(4) +# routing_group_id :integer(4) +# routing_plan_id :integer(4) +# src_name_field_id :integer(2) +# src_number_field_id :integer(2) +# src_numberlist_id :integer(4) +# tag_action_id :integer(2) +# transport_protocol_id :integer(2) +# +FactoryBot.define do + factory :importing_customers_auth, class: Importing::CustomersAuth do + transient do + _tag_action { Routing::TagAction.last } + _routing_tags { create_list(:routing_tag, 2) } + end + + o_id { nil } + error_string { nil } + + customer_name { nil } + customer_id { nil } + rateplan_name { nil } + rateplan_id { nil } + enabled { true } + account_name { nil } + account_id { nil } + gateway_name { nil } + gateway_id { nil } + src_rewrite_rule { nil } + src_rewrite_result { nil } + dst_rewrite_rule { nil } + dst_rewrite_result { nil } + name { nil } + dump_level_name { nil } + dump_level_id { 1 } + capacity { 1 } + pop_name { nil } + pop_id { nil } + src_name_rewrite_rule { nil } + src_name_rewrite_result { nil } + diversion_policy_name { nil } + diversion_policy_id { 1 } + diversion_rewrite_rule { nil } + diversion_rewrite_result { nil } + dst_numberlist_id { nil } + dst_numberlist_name { nil } + src_numberlist_id { nil } + src_numberlist_name { nil } + routing_plan_name { nil } + routing_plan_id { nil } + allow_receive_rate_limit { false } + send_billing_information { false } + enable_audio_recording { false } + check_account_balance { true } + require_incoming_auth { false } + + ip { '196.168.0.1, 127.0.0.0/8' } + src_prefix { 'src-1, src-2' } + src_number_min_length { 5 } + src_number_max_length { 10 } + dst_prefix { 'dst-1, dst-2' } + dst_number_min_length { 6 } + dst_number_max_length { 10 } + x_yeti_auth { 'x-1, x-2' } + uri_domain { 'uri-1, uri-2' } + from_domain { 'from-1, from-2' } + to_domain { 'to-1, to-2' } + + tag_action_name { _tag_action.name } + tag_action_id { _tag_action.id } + + tag_action_value_names { _routing_tags.map(&:name).join(', ') } + tag_action_value { _routing_tags.map(&:id) } + end +end diff --git a/spec/factories/importing/destinations.rb b/spec/factories/importing/destinations.rb new file mode 100644 index 000000000..7da9b496e --- /dev/null +++ b/spec/factories/importing/destinations.rb @@ -0,0 +1,79 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_destinations +# +# id :bigint(8) not null, primary key +# acd_limit :float +# asr_limit :float +# connect_fee :decimal(, ) +# dp_margin_fixed :decimal(, ) +# dp_margin_percent :decimal(, ) +# dst_number_max_length :integer(4) +# dst_number_min_length :integer(4) +# enabled :boolean +# error_string :string +# initial_interval :integer(4) +# initial_rate :decimal(, ) +# is_changed :boolean +# next_interval :integer(4) +# next_rate :decimal(, ) +# prefix :string +# profit_control_mode_name :string +# rate_group_name :string +# rate_policy_name :string +# reject_calls :boolean +# reverse_billing :boolean +# routing_tag_ids :integer(2) default([]), not null, is an Array +# routing_tag_mode_name :string +# routing_tag_names :string +# short_calls_limit :float +# use_dp_intervals :boolean +# valid_from :timestamptz +# valid_till :timestamptz +# network_prefix_id :integer(4) +# o_id :bigint(8) +# profit_control_mode_id :integer(2) +# rate_group_id :integer(4) +# rate_policy_id :integer(4) +# routing_tag_mode_id :integer(2) +# +FactoryBot.define do + factory :importing_destination, class: Importing::Destination do + transient do + _tags { create_list(:routing_tag, 2) } + end + + o_id { nil } + error_string { nil } + + prefix { nil } + rate_group_name { nil } + rate_group_id { nil } + connect_fee { 0 } + enabled { true } + reject_calls { false } + initial_interval { 60 } + next_interval { 60 } + initial_rate { 0 } + next_rate { 0 } + rate_policy_name { Routing::DestinationRatePolicy::POLICIES[Routing::DestinationRatePolicy::POLICY_FIXED] } + rate_policy_id { Routing::DestinationRatePolicy::POLICY_FIXED } + dp_margin_fixed { 0 } + dp_margin_percent { 0 } + use_dp_intervals { false } + valid_from { DateTime.now } + valid_till { DateTime.now + 5.years } + asr_limit { 0.0 } + acd_limit { 0.0 } + short_calls_limit { 0.0 } + reverse_billing { false } + + dst_number_min_length { 1 } + dst_number_max_length { 7 } + + routing_tag_ids { _tags.map(&:id) } + routing_tag_names { _tags.map(&:name).join(', ') } + end +end diff --git a/spec/factories/importing/dialpeers.rb b/spec/factories/importing/dialpeers.rb new file mode 100644 index 000000000..0808d1120 --- /dev/null +++ b/spec/factories/importing/dialpeers.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: import_dialpeers +# +# id :bigint(8) not null, primary key +# account_name :string +# acd_limit :float +# asr_limit :float +# capacity :integer(4) +# connect_fee :decimal(, ) +# dst_number_max_length :integer(4) +# dst_number_min_length :integer(4) +# dst_rewrite_result :string +# dst_rewrite_rule :string +# enabled :boolean +# error_string :string +# exclusive_route :boolean +# force_hit_rate :float +# gateway_group_name :string +# gateway_name :string +# initial_interval :integer(4) +# initial_rate :decimal(, ) +# is_changed :boolean +# lcr_rate_multiplier :decimal(, ) +# locked :boolean +# next_interval :integer(4) +# next_rate :decimal(, ) +# prefix :string +# priority :integer(4) +# reverse_billing :boolean +# routeset_discriminator_name :string +# routing_group_name :string +# routing_tag_ids :integer(2) default([]), not null, is an Array +# routing_tag_mode_name :string +# routing_tag_names :string +# short_calls_limit :float default(1.0), not null +# src_name_rewrite_result :string +# src_name_rewrite_rule :string +# src_rewrite_result :string +# src_rewrite_rule :string +# valid_from :datetime +# valid_till :datetime +# vendor_name :string +# account_id :integer(4) +# gateway_group_id :integer(4) +# gateway_id :integer(4) +# o_id :bigint(8) +# routeset_discriminator_id :integer(2) +# routing_group_id :integer(4) +# routing_tag_mode_id :integer(2) +# vendor_id :integer(4) +# +FactoryBot.define do + factory :importing_dialpeer, class: Importing::Dialpeer do + transient do + _tags { create_list(:routing_tag, 2) } + end + + o_id { nil } + error_string { nil } + + enabled { true } + prefix { nil } + src_rewrite_rule { nil } + dst_rewrite_rule { nil } + acd_limit { 0 } + asr_limit { 0 } + gateway_name { nil } + gateway_id { nil } + next_rate { nil } + connect_fee { nil } + vendor_name { nil } + vendor_id { nil } + account_name { nil } + account_id { nil } + src_rewrite_result { nil } + dst_rewrite_result { nil } + locked { false } + priority { 100 } + capacity { 0 } + lcr_rate_multiplier { 1 } + initial_rate { 0.0 } + initial_interval { 60 } + next_interval { 60 } + valid_from { '1970-01-01 00:00:00' } + valid_till { '2020-01-01 00:00:00' } + gateway_group_id { nil } + reverse_billing { false } + + dst_number_min_length { 1 } + dst_number_max_length { 7 } + + routing_tag_ids { _tags.map(&:id) } + routing_tag_names { _tags.map(&:name).join(', ') } + + trait :with_names do + after(:build) do |record, _ev| + record.vendor_name = record.vendor.name if record.vendor.present? + record.account_name = record.account.name if record.account.present? + record.gateway_name = record.gateway.name if record.gateway.present? + record.gateway_group_name = record.gateway_group.name if record.gateway_group.present? + record.routing_group_name = record.routing_group.name if record.routing_group.present? + record.routing_tag_mode_name = record.routing_tag_mode.name if record.routing_tag_mode.present? + record.routeset_discriminator_name = record.routeset_discriminator.name if record.routeset_discriminator.present? + end + end + end +end diff --git a/spec/factories/importing/disconnect_policies.rb b/spec/factories/importing/disconnect_policies.rb new file mode 100644 index 000000000..a20502dfe --- /dev/null +++ b/spec/factories/importing/disconnect_policies.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: import_disconnect_policies +# +# id :bigint(8) not null, primary key +# error_string :string +# is_changed :boolean +# name :string +# o_id :integer(4) +# +FactoryBot.define do + factory :importing_disconnect_policy, class: Importing::DisconnectPolicy do + o_id { nil } + name { nil } + error_string { nil } + end +end diff --git a/spec/factories/importing/gateway_groups.rb b/spec/factories/importing/gateway_groups.rb new file mode 100644 index 000000000..db14c3c08 --- /dev/null +++ b/spec/factories/importing/gateway_groups.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_gateway_groups +# +# id :bigint(8) not null, primary key +# balancing_mode_name :string +# error_string :string +# is_changed :boolean +# name :string +# prefer_same_pop :boolean +# vendor_name :string +# balancing_mode_id :integer(2) +# o_id :integer(4) +# vendor_id :integer(4) +# +FactoryBot.define do + factory :importing_gateway_group, class: Importing::GatewayGroup do + o_id { nil } + name { nil } + vendor_name { nil } + vendor_id { nil } + balancing_mode_id { 1 } + error_string { nil } + end +end diff --git a/spec/factories/importing/gateways.rb b/spec/factories/importing/gateways.rb new file mode 100644 index 000000000..bc5a59704 --- /dev/null +++ b/spec/factories/importing/gateways.rb @@ -0,0 +1,255 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_gateways +# +# id :integer(4) not null, primary key +# acd_limit :float +# allow_1xx_without_to_tag :boolean +# allow_origination :boolean +# allow_termination :boolean +# asr_limit :float +# auth_enabled :boolean +# auth_from_domain :string +# auth_from_user :string +# auth_password :string +# auth_user :string +# codec_group_name :string +# codecs_payload_order :string +# codecs_prefer_transcoding_for :string +# contractor_name :string +# dialog_nat_handling :boolean +# diversion_domain :string +# diversion_rewrite_result :string +# diversion_rewrite_rule :string +# diversion_send_mode_name :string +# dns_srv_failover_timer :integer(4) +# dst_rewrite_result :string +# dst_rewrite_rule :string +# dtmf_receive_mode_name :string +# dtmf_send_mode_name :string +# enabled :boolean +# error_string :string +# filter_noaudio_streams :boolean +# force_cancel_routeset :boolean +# force_dtmf_relay :boolean +# force_one_way_early_media :boolean +# force_symmetric_rtp :boolean +# gateway_group_name :string +# host :string +# incoming_auth_password :string +# incoming_auth_username :string +# is_changed :boolean +# is_shared :boolean +# locked :boolean +# lua_script_name :string +# max_30x_redirects :integer(4) +# media_encryption_mode_name :string +# name :string +# network_protocol_priority_name :string +# orig_append_headers_req :string +# orig_disconnect_policy_name :string +# orig_force_outbound_proxy :boolean +# orig_next_hop :string +# orig_outbound_proxy :string +# orig_proxy_transport_protocol_name :string +# orig_use_outbound_proxy :boolean +# origination_capacity :integer(2) +# pop_name :string +# port :integer(4) +# prefer_existing_codecs :boolean +# preserve_anonymous_from_domain :boolean +# priority :integer(4) +# proxy_media :boolean +# registered_aor_mode_name :string +# rel100_mode_name :string +# relay_hold :boolean +# relay_options :boolean +# relay_prack :boolean +# relay_reinvite :boolean +# relay_update :boolean +# resolve_ruri :boolean +# ringing_timeout :integer(4) +# rtp_force_relay_cn :boolean +# rtp_ping :boolean +# rtp_relay_timestamp_aligning :boolean +# rtp_timeout :integer(4) +# rx_inband_dtmf_filtering_mode_name :string +# sdp_alines_filter_list :string +# sdp_alines_filter_type_name :string +# sdp_c_location_name :string +# send_lnp_information :boolean +# sensor_level_name :string +# sensor_name :string +# session_refresh_method_name :string +# short_calls_limit :float +# single_codec_in_200ok :boolean +# sip_schema_name :string +# sip_timer_b :integer(4) +# src_name_rewrite_result :string +# src_name_rewrite_rule :string +# src_rewrite_result :string +# src_rewrite_rule :string +# sst_accept501 :boolean +# sst_enabled :boolean +# sst_maximum_timer :integer(4) +# sst_minimum_timer :integer(4) +# sst_session_expires :integer(4) +# suppress_early_media :boolean +# symmetric_rtp_nonstop :boolean +# term_append_headers_req :string +# term_disconnect_policy_name :string +# term_force_outbound_proxy :boolean +# term_next_hop :string +# term_next_hop_for_replies :boolean +# term_outbound_proxy :string +# term_proxy_transport_protocol_name :string +# term_use_outbound_proxy :boolean +# termination_capacity :integer(2) +# termination_dst_numberlist_name :string +# termination_src_numberlist_name :string +# to_rewrite_result :string +# to_rewrite_rule :string +# transport_protocol_name :string +# try_avoid_transcoding :boolean +# tx_inband_dtmf_filtering_mode_name :string +# weight :integer(2) +# codec_group_id :integer(4) +# contractor_id :integer(4) +# diversion_send_mode_id :integer(2) +# dtmf_receive_mode_id :integer(2) +# dtmf_send_mode_id :integer(2) +# gateway_group_id :integer(4) +# lua_script_id :integer(2) +# media_encryption_mode_id :integer(2) +# network_protocol_priority_id :integer(2) +# o_id :integer(4) +# orig_disconnect_policy_id :integer(4) +# orig_proxy_transport_protocol_id :integer(2) +# pop_id :integer(4) +# registered_aor_mode_id :integer(2) +# rel100_mode_id :integer(2) +# rx_inband_dtmf_filtering_mode_id :integer(2) +# sdp_alines_filter_type_id :integer(4) +# sdp_c_location_id :integer(4) +# sensor_id :integer(2) +# sensor_level_id :integer(2) +# session_refresh_method_id :integer(4) +# sip_schema_id :integer(2) +# term_disconnect_policy_id :integer(4) +# term_proxy_transport_protocol_id :integer(2) +# termination_dst_numberlist_id :integer(2) +# termination_src_numberlist_id :integer(2) +# transparent_dialog_id :boolean +# transport_protocol_id :integer(2) +# tx_inband_dtmf_filtering_mode_id :integer(2) +# +FactoryBot.define do + factory :importing_gateway, class: Importing::Gateway do + o_id { nil } + host { nil } + port { nil } + src_rewrite_rule { nil } + dst_rewrite_rule { nil } + acd_limit { nil } + asr_limit { nil } + enabled { nil } + name { nil } + auth_enabled { false } + auth_user { nil } + auth_password { nil } + term_outbound_proxy { nil } + term_next_hop_for_replies { false } + term_use_outbound_proxy { false } + contractor_id { nil } + allow_termination { true } + allow_origination { true } + proxy_media { true } + sst_enabled { false } + sst_minimum_timer { 50 } + sst_maximum_timer { 50 } + sst_accept501 { true } + session_refresh_method_id { 3 } + sst_session_expires { 50 } + term_force_outbound_proxy { false } + locked { false } + codecs_payload_order { '' } + codecs_prefer_transcoding_for { nil } + src_rewrite_result { nil } + dst_rewrite_result { nil } + capacity { 0 } + term_next_hop { nil } + orig_next_hop { nil } + orig_append_headers_req { nil } + term_append_headers_req { nil } + dialog_nat_handling { true } + orig_force_outbound_proxy { false } + orig_use_outbound_proxy { false } + orig_outbound_proxy { nil } + prefer_existing_codecs { true } + force_symmetric_rtp { true } + transparent_dialog_id { false } + sdp_alines_filter_type_name { nil } + sdp_alines_filter_type_id { 0 } + sdp_alines_filter_list { nil } + gateway_group_id { nil } + orig_disconnect_policy_id { nil } + term_disconnect_policy_id { nil } + + diversion_send_mode_id { 1 } + diversion_send_mode_name { nil } + diversion_domain { nil } + diversion_rewrite_rule { nil } + diversion_rewrite_result { nil } + + src_name_rewrite_rule { nil } + src_name_rewrite_result { nil } + priority { 100 } + pop_id { nil } + gateway_group_name { nil } + contractor_name { nil } + pop_name { nil } + session_refresh_method_name { nil } + orig_disconnect_policy_name { nil } + term_disconnect_policy_name { nil } + codec_group_id { 1 } + codec_group_name { nil } + single_codec_in_200ok { false } + ringing_timeout { nil } + symmetric_rtp_nonstop { false } + resolve_ruri { false } + force_dtmf_relay { false } + relay_options { false } + rtp_ping { false } + relay_reinvite { false } + sdp_c_location_id { 2 } + sdp_c_location_name { nil } + auth_from_user { nil } + auth_from_domain { nil } + relay_hold { false } + rtp_timeout { 30 } + relay_prack { false } + rtp_relay_timestamp_aligning { false } + allow_1xx_without_to_tag { false } + sip_timer_b { 8000 } + dns_srv_failover_timer { 2000 } + rtp_force_relay_cn { true } + sensor_id { nil } + sensor_name { nil } + sensor_level_id { 1 } + sensor_level_name { nil } + filter_noaudio_streams { false } + error_string { nil } + dtmf_send_mode_id { 1 } + dtmf_send_mode_name { 'RFC 2833' } + dtmf_receive_mode_id { 1 } + dtmf_receive_mode_name { 'RFC 2833' } + relay_update { true } + suppress_early_media { true } + send_lnp_information { true } + force_one_way_early_media { true } + max_30x_redirects { 1 } + force_cancel_routeset { false } + end +end diff --git a/spec/factories/importing/importing_account.rb b/spec/factories/importing/importing_account.rb deleted file mode 100644 index 0aa7f98bd..000000000 --- a/spec/factories/importing/importing_account.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_account, class: Importing::Account do - o_id { nil } - name { nil } - contractor_name { nil } - contractor_id { nil } - balance { 0 } - vat { 18.2 } - min_balance { 0 } - max_balance { 0 } - destination_rate_limit { 0.332 } - max_call_duration { 18_000 } - origination_capacity { 1 } - termination_capacity { 1 } - total_capacity { 3 } - error_string { nil } - end -end diff --git a/spec/factories/importing/importing_contractor.rb b/spec/factories/importing/importing_contractor.rb deleted file mode 100644 index fc9f08ff4..000000000 --- a/spec/factories/importing/importing_contractor.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_contractor, class: Importing::Contractor do - o_id { nil } - error_string { nil } - - name { nil } - enabled { true } - vendor { false } - customer { false } - - smtp_connection_name do - System::SmtpConnection.take.try(:name) || create(:smtp_connection).name - end - end -end diff --git a/spec/factories/importing/importing_customers_auth.rb b/spec/factories/importing/importing_customers_auth.rb deleted file mode 100644 index 66b8474ad..000000000 --- a/spec/factories/importing/importing_customers_auth.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_customers_auth, class: Importing::CustomersAuth do - transient do - _tag_action { Routing::TagAction.last } - _routing_tags { create_list(:routing_tag, 2) } - end - - o_id { nil } - error_string { nil } - - customer_name { nil } - customer_id { nil } - rateplan_name { nil } - rateplan_id { nil } - enabled { true } - account_name { nil } - account_id { nil } - gateway_name { nil } - gateway_id { nil } - src_rewrite_rule { nil } - src_rewrite_result { nil } - dst_rewrite_rule { nil } - dst_rewrite_result { nil } - name { nil } - dump_level_name { nil } - dump_level_id { 1 } - capacity { 1 } - pop_name { nil } - pop_id { nil } - src_name_rewrite_rule { nil } - src_name_rewrite_result { nil } - diversion_policy_name { nil } - diversion_policy_id { 1 } - diversion_rewrite_rule { nil } - diversion_rewrite_result { nil } - dst_numberlist_id { nil } - dst_numberlist_name { nil } - src_numberlist_id { nil } - src_numberlist_name { nil } - routing_plan_name { nil } - routing_plan_id { nil } - allow_receive_rate_limit { false } - send_billing_information { false } - enable_audio_recording { false } - check_account_balance { true } - require_incoming_auth { false } - - ip { '196.168.0.1, 127.0.0.0/8' } - src_prefix { 'src-1, src-2' } - src_number_min_length { 5 } - src_number_max_length { 10 } - dst_prefix { 'dst-1, dst-2' } - dst_number_min_length { 6 } - dst_number_max_length { 10 } - x_yeti_auth { 'x-1, x-2' } - uri_domain { 'uri-1, uri-2' } - from_domain { 'from-1, from-2' } - to_domain { 'to-1, to-2' } - - tag_action_name { _tag_action.name } - tag_action_id { _tag_action.id } - - tag_action_value_names { _routing_tags.map(&:name).join(', ') } - tag_action_value { _routing_tags.map(&:id) } - end -end diff --git a/spec/factories/importing/importing_destination.rb b/spec/factories/importing/importing_destination.rb deleted file mode 100644 index 1cf61999e..000000000 --- a/spec/factories/importing/importing_destination.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_destination, class: Importing::Destination do - transient do - _tags { create_list(:routing_tag, 2) } - end - - o_id { nil } - error_string { nil } - - prefix { nil } - rate_group_name { nil } - rate_group_id { nil } - connect_fee { 0 } - enabled { true } - reject_calls { false } - initial_interval { 60 } - next_interval { 60 } - initial_rate { 0 } - next_rate { 0 } - rate_policy_name { Routing::DestinationRatePolicy::POLICIES[Routing::DestinationRatePolicy::POLICY_FIXED] } - rate_policy_id { Routing::DestinationRatePolicy::POLICY_FIXED } - dp_margin_fixed { 0 } - dp_margin_percent { 0 } - use_dp_intervals { false } - valid_from { DateTime.now } - valid_till { DateTime.now + 5.years } - asr_limit { 0.0 } - acd_limit { 0.0 } - short_calls_limit { 0.0 } - reverse_billing { false } - - dst_number_min_length { 1 } - dst_number_max_length { 7 } - - routing_tag_ids { _tags.map(&:id) } - routing_tag_names { _tags.map(&:name).join(', ') } - end -end diff --git a/spec/factories/importing/importing_dialpeer.rb b/spec/factories/importing/importing_dialpeer.rb deleted file mode 100644 index efbb991e9..000000000 --- a/spec/factories/importing/importing_dialpeer.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_dialpeer, class: Importing::Dialpeer do - transient do - _tags { create_list(:routing_tag, 2) } - end - - o_id { nil } - error_string { nil } - - enabled { true } - prefix { nil } - src_rewrite_rule { nil } - dst_rewrite_rule { nil } - acd_limit { 0 } - asr_limit { 0 } - gateway_name { nil } - gateway_id { nil } - next_rate { nil } - connect_fee { nil } - vendor_name { nil } - vendor_id { nil } - account_name { nil } - account_id { nil } - src_rewrite_result { nil } - dst_rewrite_result { nil } - locked { false } - priority { 100 } - capacity { 0 } - lcr_rate_multiplier { 1 } - initial_rate { 0.0 } - initial_interval { 60 } - next_interval { 60 } - valid_from { '1970-01-01 00:00:00' } - valid_till { '2020-01-01 00:00:00' } - gateway_group_id { nil } - reverse_billing { false } - - dst_number_min_length { 1 } - dst_number_max_length { 7 } - - routing_tag_ids { _tags.map(&:id) } - routing_tag_names { _tags.map(&:name).join(', ') } - - trait :with_names do - after(:build) do |record, _ev| - record.vendor_name = record.vendor.name if record.vendor.present? - record.account_name = record.account.name if record.account.present? - record.gateway_name = record.gateway.name if record.gateway.present? - record.gateway_group_name = record.gateway_group.name if record.gateway_group.present? - record.routing_group_name = record.routing_group.name if record.routing_group.present? - record.routing_tag_mode_name = record.routing_tag_mode.name if record.routing_tag_mode.present? - record.routeset_discriminator_name = record.routeset_discriminator.name if record.routeset_discriminator.present? - end - end - end -end diff --git a/spec/factories/importing/importing_disconnect_policy.rb b/spec/factories/importing/importing_disconnect_policy.rb deleted file mode 100644 index eb94b880b..000000000 --- a/spec/factories/importing/importing_disconnect_policy.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_disconnect_policy, class: Importing::DisconnectPolicy do - o_id { nil } - name { nil } - error_string { nil } - end -end diff --git a/spec/factories/importing/importing_gateway.rb b/spec/factories/importing/importing_gateway.rb deleted file mode 100644 index 094119638..000000000 --- a/spec/factories/importing/importing_gateway.rb +++ /dev/null @@ -1,110 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_gateway, class: Importing::Gateway do - o_id { nil } - host { nil } - port { nil } - src_rewrite_rule { nil } - dst_rewrite_rule { nil } - acd_limit { nil } - asr_limit { nil } - enabled { nil } - name { nil } - auth_enabled { false } - auth_user { nil } - auth_password { nil } - term_outbound_proxy { nil } - term_next_hop_for_replies { false } - term_use_outbound_proxy { false } - contractor_id { nil } - allow_termination { true } - allow_origination { true } - proxy_media { true } - sst_enabled { false } - sst_minimum_timer { 50 } - sst_maximum_timer { 50 } - sst_accept501 { true } - session_refresh_method_id { 3 } - sst_session_expires { 50 } - term_force_outbound_proxy { false } - locked { false } - codecs_payload_order { '' } - codecs_prefer_transcoding_for { nil } - src_rewrite_result { nil } - dst_rewrite_result { nil } - capacity { 0 } - term_next_hop { nil } - orig_next_hop { nil } - orig_append_headers_req { nil } - term_append_headers_req { nil } - dialog_nat_handling { true } - orig_force_outbound_proxy { false } - orig_use_outbound_proxy { false } - orig_outbound_proxy { nil } - prefer_existing_codecs { true } - force_symmetric_rtp { true } - transparent_dialog_id { false } - sdp_alines_filter_type_name { nil } - sdp_alines_filter_type_id { 0 } - sdp_alines_filter_list { nil } - gateway_group_id { nil } - orig_disconnect_policy_id { nil } - term_disconnect_policy_id { nil } - - diversion_send_mode_id { 1 } - diversion_send_mode_name { nil } - diversion_domain { nil } - diversion_rewrite_rule { nil } - diversion_rewrite_result { nil } - - src_name_rewrite_rule { nil } - src_name_rewrite_result { nil } - priority { 100 } - pop_id { nil } - gateway_group_name { nil } - contractor_name { nil } - pop_name { nil } - session_refresh_method_name { nil } - orig_disconnect_policy_name { nil } - term_disconnect_policy_name { nil } - codec_group_id { 1 } - codec_group_name { nil } - single_codec_in_200ok { false } - ringing_timeout { nil } - symmetric_rtp_nonstop { false } - resolve_ruri { false } - force_dtmf_relay { false } - relay_options { false } - rtp_ping { false } - relay_reinvite { false } - sdp_c_location_id { 2 } - sdp_c_location_name { nil } - auth_from_user { nil } - auth_from_domain { nil } - relay_hold { false } - rtp_timeout { 30 } - relay_prack { false } - rtp_relay_timestamp_aligning { false } - allow_1xx_without_to_tag { false } - sip_timer_b { 8000 } - dns_srv_failover_timer { 2000 } - rtp_force_relay_cn { true } - sensor_id { nil } - sensor_name { nil } - sensor_level_id { 1 } - sensor_level_name { nil } - filter_noaudio_streams { false } - error_string { nil } - dtmf_send_mode_id { 1 } - dtmf_send_mode_name { 'RFC 2833' } - dtmf_receive_mode_id { 1 } - dtmf_receive_mode_name { 'RFC 2833' } - relay_update { true } - suppress_early_media { true } - send_lnp_information { true } - force_one_way_early_media { true } - max_30x_redirects { 1 } - force_cancel_routeset { false } - end -end diff --git a/spec/factories/importing/importing_gateway_group.rb b/spec/factories/importing/importing_gateway_group.rb deleted file mode 100644 index 0856d265d..000000000 --- a/spec/factories/importing/importing_gateway_group.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_gateway_group, class: Importing::GatewayGroup do - o_id { nil } - name { nil } - vendor_name { nil } - vendor_id { nil } - balancing_mode_id { 1 } - error_string { nil } - end -end diff --git a/spec/factories/importing/importing_registration.rb b/spec/factories/importing/importing_registration.rb deleted file mode 100644 index 915c4859d..000000000 --- a/spec/factories/importing/importing_registration.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_registration, class: Importing::Registration do - o_id { nil } - name { nil } - enabled { true } - pop_name { nil } - pop_id { nil } - node_name { nil } - node_id { nil } - domain { nil } - username { nil } - display_username { nil } - auth_user { nil } - proxy { nil } - contact { nil } - auth_password { nil } - expire { nil } - force_expire { false } - error_string { nil } - end -end diff --git a/spec/factories/importing/importing_routing_group.rb b/spec/factories/importing/importing_routing_group.rb deleted file mode 100644 index 92f8e4ba1..000000000 --- a/spec/factories/importing/importing_routing_group.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_routing_group, class: Importing::RoutingGroup do - o_id { nil } - name { nil } - error_string { nil } - end -end diff --git a/spec/factories/importing/importing_routing_tag_detection_rule.rb b/spec/factories/importing/importing_routing_tag_detection_rule.rb deleted file mode 100644 index 020e2ce9a..000000000 --- a/spec/factories/importing/importing_routing_tag_detection_rule.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :importing_routing_tag_detection_rule, class: Importing::RoutingTagDetectionRule do - transient do - _routing_tags { create_list(:routing_tag, 2) } - _tag_action { Routing::TagAction.take } - end - - o_id { nil } - error_string { nil } - tag_action_id { _tag_action.id } - tag_action_name { _tag_action.name } - src_prefix { 'src-1, src-2' } - dst_prefix { 'dst-1, dst-2' } - dst_area_name { 'any' } - src_area_name { 'any' } - routing_tag_ids { _routing_tags.map(&:name).join(', ') } - routing_tag_names { _routing_tags.map(&:id) } - end -end diff --git a/spec/factories/importing/importing_numberlist_item.rb b/spec/factories/importing/numberlist_items.rb similarity index 55% rename from spec/factories/importing/importing_numberlist_item.rb rename to spec/factories/importing/numberlist_items.rb index 3c09c1dfc..543852764 100644 --- a/spec/factories/importing/importing_numberlist_item.rb +++ b/spec/factories/importing/numberlist_items.rb @@ -1,5 +1,31 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: data_import.import_numberlist_items +# +# id :integer(4) not null, primary key +# action_name :string +# dst_rewrite_result :string +# dst_rewrite_rule :string +# error_string :string +# is_changed :boolean +# key :string +# lua_script_name :string +# number_max_length :integer(2) +# number_min_length :integer(2) +# numberlist_name :string +# src_rewrite_result :string +# src_rewrite_rule :string +# tag_action_name :string +# tag_action_value :integer(2) default([]), not null, is an Array +# tag_action_value_names :string +# action_id :integer(4) +# lua_script_id :integer(2) +# numberlist_id :integer(2) +# o_id :integer(4) +# tag_action_id :integer(4) +# FactoryBot.define do factory :importing_numberlist_item, class: Importing::NumberlistItem do transient do diff --git a/spec/factories/importing/importing_numberlist.rb b/spec/factories/importing/numberlists.rb similarity index 56% rename from spec/factories/importing/importing_numberlist.rb rename to spec/factories/importing/numberlists.rb index 921ab3fe4..bbb0d53b1 100644 --- a/spec/factories/importing/importing_numberlist.rb +++ b/spec/factories/importing/numberlists.rb @@ -1,5 +1,29 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: data_import.import_numberlists +# +# id :integer(4) not null, primary key +# default_action_name :string +# default_dst_rewrite_result :string +# default_dst_rewrite_rule :string +# default_src_rewrite_result :string +# default_src_rewrite_rule :string +# error_string :string +# is_changed :boolean +# lua_script_name :string +# mode_name :string +# name :string +# tag_action_name :string +# tag_action_value :integer(2) default([]), not null, is an Array +# tag_action_value_names :string +# default_action_id :integer(4) +# lua_script_id :integer(2) +# mode_id :integer(4) +# o_id :integer(2) +# tag_action_id :integer(4) +# FactoryBot.define do factory :importing_numberlist, class: Importing::Numberlist do transient do diff --git a/spec/factories/importing/importing_rateplan.rb b/spec/factories/importing/rateplans.rb similarity index 51% rename from spec/factories/importing/importing_rateplan.rb rename to spec/factories/importing/rateplans.rb index e43aad95a..a2a9724d8 100644 --- a/spec/factories/importing/importing_rateplan.rb +++ b/spec/factories/importing/rateplans.rb @@ -1,5 +1,17 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: import_rateplans +# +# id :bigint(8) not null, primary key +# error_string :string +# is_changed :boolean +# name :string +# profit_control_mode_name :string +# o_id :integer(4) +# profit_control_mode_id :integer(4) +# FactoryBot.define do factory :importing_rateplan, class: Importing::Rateplan do o_id { nil } diff --git a/spec/factories/importing/registrations.rb b/spec/factories/importing/registrations.rb new file mode 100644 index 000000000..48600b421 --- /dev/null +++ b/spec/factories/importing/registrations.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_registrations +# +# id :bigint(8) not null, primary key +# auth_password :string +# auth_user :string +# contact :string +# display_username :string +# domain :string +# enabled :boolean +# error_string :string +# expire :integer(4) +# force_expire :boolean +# is_changed :boolean +# max_attempts :integer(4) +# name :string +# node_name :string +# pop_name :string +# proxy :string +# proxy_transport_protocol_name :string +# retry_delay :integer(4) +# sip_schema_name :string +# transport_protocol_name :string +# username :string +# node_id :integer(4) +# o_id :integer(4) +# pop_id :integer(4) +# proxy_transport_protocol_id :integer(2) +# sip_schema_id :integer(2) +# transport_protocol_id :integer(2) +# +FactoryBot.define do + factory :importing_registration, class: Importing::Registration do + o_id { nil } + name { nil } + enabled { true } + pop_name { nil } + pop_id { nil } + node_name { nil } + node_id { nil } + domain { nil } + username { nil } + display_username { nil } + auth_user { nil } + proxy { nil } + contact { nil } + auth_password { nil } + expire { nil } + force_expire { false } + error_string { nil } + end +end diff --git a/spec/factories/importing/routing_groups.rb b/spec/factories/importing/routing_groups.rb new file mode 100644 index 000000000..a97507b88 --- /dev/null +++ b/spec/factories/importing/routing_groups.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: import_routing_groups +# +# id :bigint(8) not null, primary key +# error_string :string +# is_changed :boolean +# name :string +# o_id :integer(4) +# +FactoryBot.define do + factory :importing_routing_group, class: Importing::RoutingGroup do + o_id { nil } + name { nil } + error_string { nil } + end +end diff --git a/spec/factories/importing/routing_tag_detection_rules.rb b/spec/factories/importing/routing_tag_detection_rules.rb new file mode 100644 index 000000000..5dd27f05c --- /dev/null +++ b/spec/factories/importing/routing_tag_detection_rules.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: data_import.import_routing_tag_detection_rules +# +# id :bigint(8) not null, primary key +# dst_area_name :string +# dst_prefix :string +# error_string :string +# is_changed :boolean +# routing_tag_ids :integer(2) default([]), not null, is an Array +# routing_tag_names :string +# src_area_name :string +# src_prefix :string +# tag_action_name :string +# tag_action_value :integer(2) default([]), not null, is an Array +# tag_action_value_names :string +# dst_area_id :integer(4) +# o_id :bigint(8) +# src_area_id :integer(4) +# tag_action_id :integer(2) +# +# Indexes +# +# index_import_routing_tag_detection_rules_on_dst_area_id (dst_area_id) +# index_import_routing_tag_detection_rules_on_src_area_id (src_area_id) +# index_import_routing_tag_detection_rules_on_tag_action_id (tag_action_id) +# +# Foreign Keys +# +# fk_rails_c247bd5783 (tag_action_id => tag_actions.id) +# fk_rails_c8cbef7aaf (dst_area_id => areas.id) +# fk_rails_db4b62868c (src_area_id => areas.id) +# +FactoryBot.define do + factory :importing_routing_tag_detection_rule, class: Importing::RoutingTagDetectionRule do + transient do + _routing_tags { create_list(:routing_tag, 2) } + _tag_action { Routing::TagAction.take } + end + + o_id { nil } + error_string { nil } + tag_action_id { _tag_action.id } + tag_action_name { _tag_action.name } + src_prefix { 'src-1, src-2' } + dst_prefix { 'dst-1, dst-2' } + dst_area_name { 'any' } + src_area_name { 'any' } + routing_tag_ids { _routing_tags.map(&:name).join(', ') } + routing_tag_names { _routing_tags.map(&:id) } + end +end diff --git a/spec/factories/routing/lnp_cache.rb b/spec/factories/lnp/caches.rb similarity index 50% rename from spec/factories/routing/lnp_cache.rb rename to spec/factories/lnp/caches.rb index 2812976cb..374deb21b 100644 --- a/spec/factories/routing/lnp_cache.rb +++ b/spec/factories/lnp/caches.rb @@ -4,15 +4,24 @@ # # Table name: class4.lnp_cache # -# id :integer not null, primary key +# id :integer(4) not null, primary key +# data :string # dst :string not null +# expires_at :timestamptz not null # lrn :string not null -# created_at :datetime -# updated_at :datetime -# expires_at :datetime -# database_id :integer -# data :string # tag :string +# created_at :timestamptz +# updated_at :timestamptz +# database_id :integer(2) +# +# Indexes +# +# lnp_cache_dst_database_id_idx (dst,database_id) UNIQUE +# lnp_cache_expires_at_idx (expires_at) +# +# Foreign Keys +# +# lnp_cache_database_id_fkey (database_id => lnp_databases.id) # FactoryBot.define do diff --git a/spec/factories/lnp/lnp_databases.rb b/spec/factories/lnp/databases.rb similarity index 64% rename from spec/factories/lnp/lnp_databases.rb rename to spec/factories/lnp/databases.rb index 7fe1227ad..913445816 100644 --- a/spec/factories/lnp/lnp_databases.rb +++ b/spec/factories/lnp/databases.rb @@ -4,11 +4,17 @@ # # Table name: class4.lnp_databases # -# id :integer not null, primary key -# name :string not null -# created_at :datetime -# database_type :string -# database_id :integer not null +# id :integer(2) not null, primary key +# cache_ttl :integer(4) default(10800), not null +# database_type(One of Lnp::DatabaseThinq, Lnp::DatabaseSipRedirect, Lnp::DatabaseCsv) :string +# name :string not null +# created_at :timestamptz +# database_id :integer(2) not null +# +# Indexes +# +# index_class4.lnp_databases_on_database_id_and_database_type (database_id,database_type) UNIQUE +# lnp_databases_name_key (name) UNIQUE # FactoryBot.define do diff --git a/spec/factories/lnp/routing_plan_lnp_rules.rb b/spec/factories/lnp/routing_plan_lnp_rules.rb new file mode 100644 index 000000000..99602f8aa --- /dev/null +++ b/spec/factories/lnp/routing_plan_lnp_rules.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.routing_plan_lnp_rules +# +# id :integer(4) not null, primary key +# drop_call_on_error :boolean default(FALSE), not null +# dst_prefix :string default(""), not null +# lrn_rewrite_result :string +# lrn_rewrite_rule :string +# req_dst_rewrite_result :string +# req_dst_rewrite_rule :string +# rewrite_call_destination :boolean default(FALSE), not null +# created_at :timestamptz +# database_id :integer(2) not null +# routing_plan_id :integer(4) not null +# +# Indexes +# +# routing_plan_lnp_rules_database_id_idx (database_id) +# routing_plan_lnp_rules_prefix_range_routing_plan_id_idx (((dst_prefix)::prefix_range), routing_plan_id) USING gist +# routing_plan_lnp_rules_routing_plan_id_dst_prefix_database__idx (routing_plan_id,dst_prefix,database_id) UNIQUE +# +# Foreign Keys +# +# routing_plan_lnp_rules_database_id_fkey (database_id => lnp_databases.id) +# routing_plan_lnp_rules_routing_plan_id_fkey (routing_plan_id => routing_plans.id) +# + +FactoryBot.define do + factory :lnp_routing_plan_lnp_rule, class: Lnp::RoutingPlanLnpRule do + association :routing_plan, factory: :routing_plan + database { create(:lnp_database, :thinq) } + end +end diff --git a/spec/factories/log/balance_notification.rb b/spec/factories/log/balance_notifications.rb similarity index 82% rename from spec/factories/log/balance_notification.rb rename to spec/factories/log/balance_notifications.rb index b4b60057e..f9c23b9d5 100644 --- a/spec/factories/log/balance_notification.rb +++ b/spec/factories/log/balance_notifications.rb @@ -8,18 +8,14 @@ # account_balance :decimal(, ) not null # balance_high_threshold :decimal(, ) # balance_low_threshold :decimal(, ) -# created_at :datetime not null -# account_id :bigint(8) not null +# created_at :timestamptz not null +# account_id :integer(4) not null # event_id :integer(2) not null # # Indexes # # balance_notifications_account_id_idx (account_id) # -# Foreign Keys -# -# fk_rails_523e8f47b7 (account_id => accounts.id) -# FactoryBot.define do factory :balance_notification, class: Log::BalanceNotification do diff --git a/spec/factories/log/email_log.rb b/spec/factories/log/email_logs.rb similarity index 65% rename from spec/factories/log/email_log.rb rename to spec/factories/log/email_logs.rb index 2aca733d1..169a7e25a 100644 --- a/spec/factories/log/email_log.rb +++ b/spec/factories/log/email_logs.rb @@ -4,18 +4,18 @@ # # Table name: notifications.email_logs # -# id :integer not null, primary key -# batch_id :integer -# created_at :datetime -# sent_at :datetime -# contact_id :integer -# smtp_connection_id :integer -# mail_to :string not null +# id :bigint(8) not null, primary key +# error :string # mail_from :string not null -# subject :string not null +# mail_to :string not null # msg :string -# error :string -# attachment_id :integer is an Array +# sent_at :timestamptz +# subject :string not null +# created_at :timestamptz +# attachment_id :integer(4) is an Array +# batch_id :bigint(8) +# contact_id :integer(4) +# smtp_connection_id :integer(4) # FactoryBot.define do diff --git a/spec/factories/log/logic_log.rb b/spec/factories/logic_logs.rb similarity index 64% rename from spec/factories/log/logic_log.rb rename to spec/factories/logic_logs.rb index 12b3cb318..b30c54192 100644 --- a/spec/factories/log/logic_log.rb +++ b/spec/factories/logic_logs.rb @@ -4,12 +4,12 @@ # # Table name: logic_log # -# id :integer not null, primary key -# source :string not null -# level :integer not null +# id :bigint(8) not null, primary key +# level :integer(4) not null # msg :text -# txid :integer not null -# timestamp :datetime not null +# source :string not null +# timestamp :timestamptz not null +# txid :bigint(8) not null # FactoryBot.define do diff --git a/spec/factories/node.rb b/spec/factories/node.rb deleted file mode 100644 index 89eba0afe..000000000 --- a/spec/factories/node.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :node, class: Node do - sequence(:id) { |n| n } - sequence(:name) { |n| "Node #{n}" } - sequence(:rpc_endpoint) { |n| "127.0.0.1:#{1 + n}" } - - association :pop, factory: :pop - - trait :filled do - registrations { build_list :registration, 2 } - end - end -end diff --git a/spec/factories/nodes.rb b/spec/factories/nodes.rb new file mode 100644 index 000000000..ff80b2527 --- /dev/null +++ b/spec/factories/nodes.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: nodes +# +# id :integer(4) not null, primary key +# name :string +# rpc_endpoint :string +# pop_id :integer(4) not null +# +# Indexes +# +# node_name_key (name) UNIQUE +# nodes_rpc_endpoint_key (rpc_endpoint) UNIQUE +# +# Foreign Keys +# +# node_pop_id_fkey (pop_id => pops.id) +# +FactoryBot.define do + factory :node, class: Node do + sequence(:id) { |n| n } + sequence(:name) { |n| "Node #{n}" } + sequence(:rpc_endpoint) { |n| "127.0.0.1:#{1 + n}" } + + association :pop, factory: :pop + + trait :filled do + registrations { build_list :registration, 2 } + end + end +end diff --git a/spec/factories/system/notification_attachment.rb b/spec/factories/notification/attachments.rb similarity index 100% rename from spec/factories/system/notification_attachment.rb rename to spec/factories/notification/attachments.rb diff --git a/spec/factories/payment.rb b/spec/factories/payments.rb similarity index 56% rename from spec/factories/payment.rb rename to spec/factories/payments.rb index 8f9a04268..a31bb61f4 100644 --- a/spec/factories/payment.rb +++ b/spec/factories/payments.rb @@ -1,5 +1,28 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: payments +# +# id :bigint(8) not null, primary key +# amount :decimal(, ) not null +# notes :string +# private_notes :string +# uuid :uuid not null +# created_at :timestamptz not null +# account_id :integer(4) not null +# status_id :integer(2) default(20), not null +# type_id :integer(2) default(20), not null +# +# Indexes +# +# payments_account_id_idx (account_id) +# payments_uuid_key (uuid) UNIQUE +# +# Foreign Keys +# +# payments_account_id_fkey (account_id => accounts.id) +# FactoryBot.define do factory :payment, class: Payment do amount { 10 } diff --git a/spec/factories/pop.rb b/spec/factories/pops.rb similarity index 68% rename from spec/factories/pop.rb rename to spec/factories/pops.rb index a3fb6f6e6..80b696175 100644 --- a/spec/factories/pop.rb +++ b/spec/factories/pops.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: pops +# +# id :integer(4) not null, primary key +# name :string not null +# +# Indexes +# +# pop_name_key (name) UNIQUE +# FactoryBot.define do factory :pop, class: Pop do sequence(:id) { |n| n } diff --git a/spec/factories/registration.rb b/spec/factories/registration.rb deleted file mode 100644 index 2501bc307..000000000 --- a/spec/factories/registration.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :registration, class: Equipment::Registration do - sequence(:name) { |n| "Equipment Registration #{n}" } - domain { 'localhost' } - username { 'user name' } - contact { 'sip:user@domain' } - sip_schema_id { 1 } - - trait :filled do - node - pop - transport_protocol { Equipment::TransportProtocol.take } - proxy_transport_protocol { Equipment::TransportProtocol.take } - sequence(:sip_interface_name) { |n| "interface_#{n}" } - end - end -end diff --git a/spec/factories/reports/custom_cdr_scheduler.rb b/spec/factories/report/custom_cdr_schedulers.rb similarity index 55% rename from spec/factories/reports/custom_cdr_scheduler.rb rename to spec/factories/report/custom_cdr_schedulers.rb index dd9521854..563fb147b 100644 --- a/spec/factories/reports/custom_cdr_scheduler.rb +++ b/spec/factories/report/custom_cdr_schedulers.rb @@ -4,15 +4,19 @@ # # Table name: reports.cdr_custom_report_schedulers # -# id :integer not null, primary key -# created_at :datetime -# period_id :integer not null +# id :integer(4) not null, primary key # filter :string # group_by :string is an Array -# send_to :integer is an Array -# last_run_at :datetime -# next_run_at :datetime -# customer_id :integer +# last_run_at :timestamptz +# next_run_at :timestamptz +# send_to :integer(4) is an Array +# created_at :timestamptz +# customer_id :integer(4) +# period_id :integer(4) not null +# +# Foreign Keys +# +# cdr_custom_report_schedulers_period_id_fkey (period_id => scheduler_periods.id) # FactoryBot.define do diff --git a/spec/factories/reports/custom_cdr.rb b/spec/factories/report/custom_cdrs.rb similarity index 84% rename from spec/factories/reports/custom_cdr.rb rename to spec/factories/report/custom_cdrs.rb index 4fb37366b..f27e7dc6b 100644 --- a/spec/factories/reports/custom_cdr.rb +++ b/spec/factories/report/custom_cdrs.rb @@ -6,18 +6,14 @@ # # id :integer(4) not null, primary key # completed :boolean default(FALSE), not null -# date_end :datetime -# date_start :datetime +# date_end :timestamptz +# date_start :timestamptz # filter :string # group_by :string is an Array # send_to :integer(4) is an Array -# created_at :datetime +# created_at :timestamptz # customer_id :integer(4) # -# Indexes -# -# cdr_custom_report_id_idx (id) UNIQUE WHERE (id IS NOT NULL) -# FactoryBot.define do factory :custom_cdr, class: Report::CustomCdr do diff --git a/spec/factories/report/custom_data.rb b/spec/factories/report/custom_data.rb new file mode 100644 index 000000000..a86a33185 --- /dev/null +++ b/spec/factories/report/custom_data.rb @@ -0,0 +1,104 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: reports.cdr_custom_report_data +# +# id :bigint(8) not null, primary key +# agg_asr_origination :decimal(, ) +# agg_asr_termination :decimal(, ) +# agg_calls_acd :decimal(, ) +# agg_calls_count :bigint(8) +# agg_calls_duration :bigint(8) +# agg_customer_calls_duration :bigint(8) +# agg_customer_price :decimal(, ) +# agg_customer_price_no_vat :decimal(, ) +# agg_profit :decimal(, ) +# agg_short_calls_count :bigint(8) +# agg_successful_calls_count :bigint(8) +# agg_uniq_calls_count :bigint(8) +# agg_vendor_calls_duration :bigint(8) +# agg_vendor_price :decimal(, ) +# auth_orig_ip :string +# destination_fee :decimal(, ) +# destination_initial_interval :integer(4) +# destination_initial_rate :decimal(, ) +# destination_next_interval :integer(4) +# destination_next_rate :decimal(, ) +# destination_reverse_billing :boolean +# dialpeer_fee :decimal(, ) +# dialpeer_initial_interval :integer(4) +# dialpeer_initial_rate :decimal(, ) +# dialpeer_next_interval :integer(4) +# dialpeer_next_rate :decimal(, ) +# dialpeer_reverse_billing :boolean +# diversion_in :string +# diversion_out :string +# dst_prefix_in :string +# dst_prefix_out :string +# duration :integer(4) +# internal_disconnect_code :integer(4) +# internal_disconnect_reason :string +# is_last_cdr :boolean +# lega_disconnect_code :integer(4) +# lega_disconnect_reason :string +# lega_user_agent :string +# legb_disconnect_code :integer(4) +# legb_disconnect_reason :string +# legb_user_agent :string +# p_charge_info_in :string +# routing_attempt :integer(4) +# sign_orig_ip :string +# sign_orig_local_ip :string +# sign_orig_local_port :integer(4) +# sign_orig_port :integer(4) +# sign_term_ip :string +# sign_term_local_ip :string +# sign_term_local_port :integer(4) +# sign_term_port :integer(4) +# src_name_in :string +# src_name_out :string +# src_prefix_in :string +# src_prefix_out :string +# success :boolean +# time_connect :timestamptz +# time_end :timestamptz +# time_start :timestamptz +# customer_acc_id :integer(4) +# customer_auth_id :integer(4) +# customer_id :integer(4) +# customer_invoice_id :integer(4) +# destination_id :integer(4) +# destination_rate_policy_id :integer(4) +# dialpeer_id :integer(4) +# disconnect_initiator_id :integer(4) +# dst_area_id :integer(4) +# dst_country_id :integer(4) +# dst_network_id :integer(4) +# node_id :integer(4) +# orig_gw_id :integer(4) +# pop_id :integer(4) +# rateplan_id :integer(4) +# report_id :integer(4) not null +# routing_group_id :integer(4) +# src_area_id :integer(4) +# src_country_id :integer(4) +# src_network_id :integer(4) +# term_gw_id :integer(4) +# vendor_acc_id :integer(4) +# vendor_id :integer(4) +# vendor_invoice_id :integer(4) +# +# Indexes +# +# cdr_custom_report_data_report_id_idx (report_id) +# +# Foreign Keys +# +# cdr_custom_report_data_report_id_fkey (report_id => cdr_custom_report.id) +# +FactoryBot.define do + factory :custom_data, class: Report::CustomData do + report { association :interval_cdr } + end +end diff --git a/spec/factories/report/customer_traffic_schedulers.rb b/spec/factories/report/customer_traffic_schedulers.rb new file mode 100644 index 000000000..9c5495385 --- /dev/null +++ b/spec/factories/report/customer_traffic_schedulers.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: reports.customer_traffic_report_schedulers +# +# id :integer(4) not null, primary key +# last_run_at :timestamptz +# next_run_at :timestamptz +# send_to :integer(4) is an Array +# created_at :timestamptz +# customer_id :integer(4) not null +# period_id :integer(4) not null +# +# Foreign Keys +# +# customer_traffic_report_schedulers_period_id_fkey (period_id => scheduler_periods.id) +# + +FactoryBot.define do + factory :customer_traffic_scheduler, class: Report::CustomerTrafficScheduler do + period { Report::SchedulerPeriod.take || build(:period_scheduler) } + association :customer + end +end diff --git a/spec/factories/reports/customer_traffic.rb b/spec/factories/report/customer_traffics.rb similarity index 54% rename from spec/factories/reports/customer_traffic.rb rename to spec/factories/report/customer_traffics.rb index dd664eb87..434d897ad 100644 --- a/spec/factories/reports/customer_traffic.rb +++ b/spec/factories/report/customer_traffics.rb @@ -4,11 +4,13 @@ # # Table name: reports.customer_traffic_report # -# id :integer not null, primary key -# created_at :datetime -# date_start :datetime -# date_end :datetime -# customer_id :integer not null +# id :bigint(8) not null, primary key +# completed :boolean default(FALSE), not null +# date_end :timestamptz +# date_start :timestamptz +# send_to :integer(4) is an Array +# created_at :timestamptz +# customer_id :integer(4) not null # FactoryBot.define do diff --git a/spec/factories/reports/interval_cdr_scheduler.rb b/spec/factories/report/interval_cdr_schedulers.rb similarity index 56% rename from spec/factories/reports/interval_cdr_scheduler.rb rename to spec/factories/report/interval_cdr_schedulers.rb index 467ab843c..6a8af1eba 100644 --- a/spec/factories/reports/interval_cdr_scheduler.rb +++ b/spec/factories/report/interval_cdr_schedulers.rb @@ -4,17 +4,21 @@ # # Table name: reports.cdr_interval_report_schedulers # -# id :integer not null, primary key -# created_at :datetime -# period_id :integer not null +# id :integer(4) not null, primary key +# aggregate_by :string # filter :string # group_by :string is an Array -# interval_length :integer -# aggregator_id :integer -# aggregate_by :string -# send_to :integer is an Array -# last_run_at :datetime -# next_run_at :datetime +# interval_length :integer(4) +# last_run_at :timestamptz +# next_run_at :timestamptz +# send_to :integer(4) is an Array +# created_at :timestamptz +# aggregator_id :integer(4) +# period_id :integer(4) not null +# +# Foreign Keys +# +# cdr_interval_report_schedulers_period_id_fkey (period_id => scheduler_periods.id) # FactoryBot.define do diff --git a/spec/factories/report/interval_cdrs.rb b/spec/factories/report/interval_cdrs.rb new file mode 100644 index 000000000..91aef425c --- /dev/null +++ b/spec/factories/report/interval_cdrs.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: reports.cdr_interval_report +# +# id :integer(4) not null, primary key +# aggregate_by :string not null +# completed :boolean default(FALSE), not null +# date_end :timestamptz not null +# date_start :timestamptz not null +# filter :string +# group_by :string is an Array +# interval_length :integer(4) not null +# send_to :integer(4) is an Array +# created_at :timestamptz not null +# aggregator_id :integer(4) not null +# +# Foreign Keys +# +# cdr_interval_report_aggregator_id_fkey (aggregator_id => cdr_interval_report_aggregator.id) +# + +FactoryBot.define do + factory :interval_cdr, class: Report::IntervalCdr do + date_start { Time.now.utc } + date_end { Time.now.utc + 1.week } + interval_length { 10 } + group_by { %w[disconnect_initiator_id] } + aggregator_id { Report::IntervalAggregator.take.id } + aggregate_by { 'destination_fee' } + end +end diff --git a/spec/factories/report/interval_data.rb b/spec/factories/report/interval_data.rb new file mode 100644 index 000000000..ba2fe88a1 --- /dev/null +++ b/spec/factories/report/interval_data.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: reports.cdr_interval_report_data +# +# id :bigint(8) not null, primary key +# aggregated_value :decimal(, ) +# auth_orig_ip :string +# customer_price :decimal(, ) +# destination_fee :decimal(, ) +# destination_initial_interval :integer(4) +# destination_initial_rate :decimal(, ) +# destination_next_interval :integer(4) +# destination_next_rate :decimal(, ) +# destination_reverse_billing :boolean +# dialpeer_fee :decimal(, ) +# dialpeer_initial_interval :integer(4) +# dialpeer_initial_rate :decimal(, ) +# dialpeer_next_interval :integer(4) +# dialpeer_next_rate :decimal(, ) +# dialpeer_reverse_billing :boolean +# diversion_in :string +# diversion_out :string +# dst_prefix_in :string +# dst_prefix_out :string +# dump_file :string +# duration :integer(4) +# internal_disconnect_code :integer(4) +# internal_disconnect_reason :string +# is_last_cdr :boolean +# lega_disconnect_code :integer(4) +# lega_disconnect_reason :string +# legb_disconnect_code :integer(4) +# legb_disconnect_reason :string +# local_tag :string +# log_rtp :boolean +# log_sip :boolean +# profit :decimal(, ) +# routing_attempt :integer(4) +# sign_orig_ip :string +# sign_orig_local_ip :string +# sign_orig_local_port :integer(4) +# sign_orig_port :integer(4) +# sign_term_ip :string +# sign_term_local_ip :string +# sign_term_local_port :integer(4) +# sign_term_port :integer(4) +# src_name_in :string +# src_name_out :string +# src_prefix_in :string +# src_prefix_out :string +# success :boolean +# time_connect :timestamptz +# time_end :timestamptz +# time_start :timestamptz +# timestamp :timestamptz +# vendor_price :decimal(, ) +# customer_acc_id :integer(4) +# customer_auth_id :integer(4) +# customer_id :integer(4) +# customer_invoice_id :integer(4) +# destination_id :integer(4) +# destination_rate_policy_id :integer(4) +# dialpeer_id :integer(4) +# disconnect_initiator_id :integer(4) +# dst_country_id :integer(4) +# dst_network_id :integer(4) +# node_id :integer(4) +# orig_call_id :string +# orig_gw_id :integer(4) +# pop_id :integer(4) +# rateplan_id :integer(4) +# report_id :integer(4) not null +# routing_group_id :integer(4) +# term_call_id :string +# term_gw_id :integer(4) +# vendor_acc_id :integer(4) +# vendor_id :integer(4) +# vendor_invoice_id :integer(4) +# +# Indexes +# +# cdr_interval_report_data_report_id_idx (report_id) +# +# Foreign Keys +# +# cdr_interval_report_data_report_id_fkey (report_id => cdr_interval_report.id) +# +FactoryBot.define do + factory :interval_data, class: Report::IntervalData do + report { association :interval_cdr } + disconnect_initiator_id { 1 } + end +end diff --git a/spec/factories/report/realtime/bad_routings.rb b/spec/factories/report/realtime/bad_routings.rb new file mode 100644 index 000000000..fba603147 --- /dev/null +++ b/spec/factories/report/realtime/bad_routings.rb @@ -0,0 +1,165 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: cdr.cdr +# +# id :bigint(8) not null +# audio_recorded :boolean +# auth_orig_ip :inet +# auth_orig_port :integer(4) +# core_version :string +# customer_acc_vat :decimal(, ) +# customer_account_check_balance :boolean +# customer_auth_external_type :string +# customer_auth_name :string +# customer_duration :integer(4) +# customer_price :decimal(, ) +# customer_price_no_vat :decimal(, ) +# destination_fee :decimal(, ) +# destination_initial_interval :integer(4) +# destination_initial_rate :decimal(, ) +# destination_next_interval :integer(4) +# destination_next_rate :decimal(, ) +# destination_prefix :string +# destination_reverse_billing :boolean +# dialpeer_fee :decimal(, ) +# dialpeer_initial_interval :integer(4) +# dialpeer_initial_rate :decimal(, ) +# dialpeer_next_interval :integer(4) +# dialpeer_next_rate :decimal(, ) +# dialpeer_prefix :string +# dialpeer_reverse_billing :boolean +# diversion_in :string +# diversion_out :string +# dst_prefix_in :string +# dst_prefix_out :string +# dst_prefix_routing :string +# duration :integer(4) +# early_media_present :boolean +# from_domain :string +# global_tag :string +# internal_disconnect_code :integer(4) +# internal_disconnect_reason :string +# is_last_cdr :boolean +# is_redirected :boolean +# lega_disconnect_code :integer(4) +# lega_disconnect_reason :string +# lega_identity :jsonb +# lega_q850_cause :integer(2) +# lega_q850_params :string +# lega_q850_text :string +# lega_user_agent :string +# legb_disconnect_code :integer(4) +# legb_disconnect_reason :string +# legb_local_tag :string +# legb_outbound_proxy :string +# legb_q850_cause :integer(2) +# legb_q850_params :string +# legb_q850_text :string +# legb_ruri :string +# legb_user_agent :string +# local_tag :string +# lrn :string +# metadata :jsonb +# p_charge_info_in :string +# pai_in :string +# pai_out :string +# pdd :float +# ppi_in :string +# ppi_out :string +# privacy_in :string +# privacy_out :string +# profit :decimal(, ) +# routing_attempt :integer(4) +# routing_delay :float +# routing_tag_ids :integer(2) is an Array +# rpid_in :string +# rpid_out :string +# rpid_privacy_in :string +# rpid_privacy_out :string +# rtt :float +# ruri_domain :string +# sign_orig_ip :string +# sign_orig_local_ip :string +# sign_orig_local_port :integer(4) +# sign_orig_port :integer(4) +# sign_term_ip :string +# sign_term_local_ip :string +# sign_term_local_port :integer(4) +# sign_term_port :integer(4) +# src_name_in :string +# src_name_out :string +# src_prefix_in :string +# src_prefix_out :string +# src_prefix_routing :string +# success :boolean +# time_connect :timestamptz +# time_end :timestamptz +# time_start :timestamptz not null +# to_domain :string +# uuid :uuid +# vendor_duration :integer(4) +# vendor_price :decimal(, ) +# yeti_version :string +# auth_orig_transport_protocol_id :integer(2) +# customer_acc_external_id :bigint(8) +# customer_acc_id :integer(4) +# customer_auth_external_id :bigint(8) +# customer_auth_id :integer(4) +# customer_external_id :bigint(8) +# customer_id :integer(4) +# customer_invoice_id :integer(4) +# destination_id :integer(4) +# destination_rate_policy_id :integer(4) +# dialpeer_id :integer(4) +# disconnect_initiator_id :integer(4) +# dst_area_id :integer(4) +# dst_country_id :integer(4) +# dst_network_id :integer(4) +# dump_level_id :integer(2) +# failed_resource_id :bigint(8) +# failed_resource_type_id :integer(2) +# internal_disconnect_code_id :integer(2) +# lega_ss_status_id :integer(2) +# legb_ss_status_id :integer(2) +# lnp_database_id :integer(2) +# node_id :integer(4) +# orig_call_id :string +# orig_gw_external_id :bigint(8) +# orig_gw_id :integer(4) +# package_counter_id :bigint(8) +# pop_id :integer(4) +# rateplan_id :integer(4) +# routing_group_id :integer(4) +# routing_plan_id :integer(4) +# sign_orig_transport_protocol_id :integer(2) +# sign_term_transport_protocol_id :integer(2) +# src_area_id :integer(4) +# src_country_id :integer(4) +# src_network_id :integer(4) +# term_call_id :string +# term_gw_external_id :bigint(8) +# term_gw_id :integer(4) +# vendor_acc_external_id :bigint(8) +# vendor_acc_id :integer(4) +# vendor_external_id :bigint(8) +# vendor_id :integer(4) +# vendor_invoice_id :integer(4) +# +# Indexes +# +# cdr_customer_acc_external_id_time_start_idx (customer_acc_external_id,time_start) WHERE is_last_cdr +# cdr_customer_acc_id_time_start_idx1 (customer_acc_id,time_start) +# cdr_customer_id_time_start_idx (customer_id,time_start) +# cdr_id_idx (id) +# cdr_time_start_idx (time_start) +# cdr_vendor_id_time_start_idx (vendor_id,time_start) +# +FactoryBot.define do + factory :bad_routing, class: Report::Realtime::BadRouting, parent: :cdr do + time_start { 110.seconds.ago } # this record will be available in page during 10 second + disconnect_initiator_id { Cdr::Cdr::DISCONNECT_INITIATOR_ROUTING } + association :customer_auth, factory: :customers_auth + end +end diff --git a/spec/factories/report/realtime/not_authenticateds.rb b/spec/factories/report/realtime/not_authenticateds.rb new file mode 100644 index 000000000..2db996937 --- /dev/null +++ b/spec/factories/report/realtime/not_authenticateds.rb @@ -0,0 +1,165 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: cdr.cdr +# +# id :bigint(8) not null +# audio_recorded :boolean +# auth_orig_ip :inet +# auth_orig_port :integer(4) +# core_version :string +# customer_acc_vat :decimal(, ) +# customer_account_check_balance :boolean +# customer_auth_external_type :string +# customer_auth_name :string +# customer_duration :integer(4) +# customer_price :decimal(, ) +# customer_price_no_vat :decimal(, ) +# destination_fee :decimal(, ) +# destination_initial_interval :integer(4) +# destination_initial_rate :decimal(, ) +# destination_next_interval :integer(4) +# destination_next_rate :decimal(, ) +# destination_prefix :string +# destination_reverse_billing :boolean +# dialpeer_fee :decimal(, ) +# dialpeer_initial_interval :integer(4) +# dialpeer_initial_rate :decimal(, ) +# dialpeer_next_interval :integer(4) +# dialpeer_next_rate :decimal(, ) +# dialpeer_prefix :string +# dialpeer_reverse_billing :boolean +# diversion_in :string +# diversion_out :string +# dst_prefix_in :string +# dst_prefix_out :string +# dst_prefix_routing :string +# duration :integer(4) +# early_media_present :boolean +# from_domain :string +# global_tag :string +# internal_disconnect_code :integer(4) +# internal_disconnect_reason :string +# is_last_cdr :boolean +# is_redirected :boolean +# lega_disconnect_code :integer(4) +# lega_disconnect_reason :string +# lega_identity :jsonb +# lega_q850_cause :integer(2) +# lega_q850_params :string +# lega_q850_text :string +# lega_user_agent :string +# legb_disconnect_code :integer(4) +# legb_disconnect_reason :string +# legb_local_tag :string +# legb_outbound_proxy :string +# legb_q850_cause :integer(2) +# legb_q850_params :string +# legb_q850_text :string +# legb_ruri :string +# legb_user_agent :string +# local_tag :string +# lrn :string +# metadata :jsonb +# p_charge_info_in :string +# pai_in :string +# pai_out :string +# pdd :float +# ppi_in :string +# ppi_out :string +# privacy_in :string +# privacy_out :string +# profit :decimal(, ) +# routing_attempt :integer(4) +# routing_delay :float +# routing_tag_ids :integer(2) is an Array +# rpid_in :string +# rpid_out :string +# rpid_privacy_in :string +# rpid_privacy_out :string +# rtt :float +# ruri_domain :string +# sign_orig_ip :string +# sign_orig_local_ip :string +# sign_orig_local_port :integer(4) +# sign_orig_port :integer(4) +# sign_term_ip :string +# sign_term_local_ip :string +# sign_term_local_port :integer(4) +# sign_term_port :integer(4) +# src_name_in :string +# src_name_out :string +# src_prefix_in :string +# src_prefix_out :string +# src_prefix_routing :string +# success :boolean +# time_connect :timestamptz +# time_end :timestamptz +# time_start :timestamptz not null +# to_domain :string +# uuid :uuid +# vendor_duration :integer(4) +# vendor_price :decimal(, ) +# yeti_version :string +# auth_orig_transport_protocol_id :integer(2) +# customer_acc_external_id :bigint(8) +# customer_acc_id :integer(4) +# customer_auth_external_id :bigint(8) +# customer_auth_id :integer(4) +# customer_external_id :bigint(8) +# customer_id :integer(4) +# customer_invoice_id :integer(4) +# destination_id :integer(4) +# destination_rate_policy_id :integer(4) +# dialpeer_id :integer(4) +# disconnect_initiator_id :integer(4) +# dst_area_id :integer(4) +# dst_country_id :integer(4) +# dst_network_id :integer(4) +# dump_level_id :integer(2) +# failed_resource_id :bigint(8) +# failed_resource_type_id :integer(2) +# internal_disconnect_code_id :integer(2) +# lega_ss_status_id :integer(2) +# legb_ss_status_id :integer(2) +# lnp_database_id :integer(2) +# node_id :integer(4) +# orig_call_id :string +# orig_gw_external_id :bigint(8) +# orig_gw_id :integer(4) +# package_counter_id :bigint(8) +# pop_id :integer(4) +# rateplan_id :integer(4) +# routing_group_id :integer(4) +# routing_plan_id :integer(4) +# sign_orig_transport_protocol_id :integer(2) +# sign_term_transport_protocol_id :integer(2) +# src_area_id :integer(4) +# src_country_id :integer(4) +# src_network_id :integer(4) +# term_call_id :string +# term_gw_external_id :bigint(8) +# term_gw_id :integer(4) +# vendor_acc_external_id :bigint(8) +# vendor_acc_id :integer(4) +# vendor_external_id :bigint(8) +# vendor_id :integer(4) +# vendor_invoice_id :integer(4) +# +# Indexes +# +# cdr_customer_acc_external_id_time_start_idx (customer_acc_external_id,time_start) WHERE is_last_cdr +# cdr_customer_acc_id_time_start_idx1 (customer_acc_id,time_start) +# cdr_customer_id_time_start_idx (customer_id,time_start) +# cdr_id_idx (id) +# cdr_time_start_idx (time_start) +# cdr_vendor_id_time_start_idx (vendor_id,time_start) +# +FactoryBot.define do + factory :not_authenticated, class: Report::Realtime::NotAuthenticated, parent: :cdr do + time_start { 110.seconds.ago.utc } # this record will be available in page during 10 second + auth_orig_ip { IPAddr.new(rand(2**32), Socket::AF_INET) } + customer_auth_id { nil } + end +end diff --git a/spec/factories/reports/period_scheduler.rb b/spec/factories/report/scheduler_periods.rb similarity index 74% rename from spec/factories/reports/period_scheduler.rb rename to spec/factories/report/scheduler_periods.rb index cfcced88c..05e7abb24 100644 --- a/spec/factories/reports/period_scheduler.rb +++ b/spec/factories/report/scheduler_periods.rb @@ -4,9 +4,13 @@ # # Table name: reports.scheduler_periods # -# id :integer not null, primary key +# id :integer(2) not null, primary key # name :string not null # +# Indexes +# +# scheduler_periods_name_key (name) UNIQUE +# FactoryBot.define do factory :period_scheduler, class: Report::SchedulerPeriod do diff --git a/spec/factories/report/vendor_traffic_schedulers.rb b/spec/factories/report/vendor_traffic_schedulers.rb new file mode 100644 index 000000000..2a8c356b4 --- /dev/null +++ b/spec/factories/report/vendor_traffic_schedulers.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: reports.vendor_traffic_report_schedulers +# +# id :integer(4) not null, primary key +# last_run_at :timestamptz +# next_run_at :timestamptz +# send_to :integer(4) is an Array +# created_at :timestamptz +# period_id :integer(4) not null +# vendor_id :integer(4) not null +# +# Foreign Keys +# +# vendor_traffic_report_schedulers_period_id_fkey (period_id => scheduler_periods.id) +# + +FactoryBot.define do + factory :vendor_traffic_scheduler, class: Report::VendorTrafficScheduler do + period { Report::SchedulerPeriod.take } + vendor + end +end diff --git a/spec/factories/reports/vendor_traffic.rb b/spec/factories/report/vendor_traffics.rb similarity index 51% rename from spec/factories/reports/vendor_traffic.rb rename to spec/factories/report/vendor_traffics.rb index f4427b08b..375c65274 100644 --- a/spec/factories/reports/vendor_traffic.rb +++ b/spec/factories/report/vendor_traffics.rb @@ -4,11 +4,13 @@ # # Table name: reports.vendor_traffic_report # -# id :integer not null, primary key -# created_at :datetime -# date_start :datetime -# date_end :datetime -# vendor_id :integer not null +# id :bigint(8) not null, primary key +# completed :boolean default(FALSE), not null +# date_end :timestamptz +# date_start :timestamptz +# send_to :integer(4) is an Array +# created_at :timestamptz +# vendor_id :integer(4) not null # FactoryBot.define do diff --git a/spec/factories/reports/custom_data.rb b/spec/factories/reports/custom_data.rb deleted file mode 100644 index 2314628ca..000000000 --- a/spec/factories/reports/custom_data.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :custom_data, class: Report::CustomData do - report { association :interval_cdr } - end -end diff --git a/spec/factories/reports/customer_traffic_scheduler.rb b/spec/factories/reports/customer_traffic_scheduler.rb deleted file mode 100644 index d69b9dfed..000000000 --- a/spec/factories/reports/customer_traffic_scheduler.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: reports.customer_traffic_report_schedulers -# -# id :integer not null, primary key -# created_at :datetime -# period_id :integer not null -# customer_id :integer not null -# last_run_at :datetime -# next_run_at :datetime -# send_to :integer is an Array -# - -FactoryBot.define do - factory :customer_traffic_scheduler, class: Report::CustomerTrafficScheduler do - period { Report::SchedulerPeriod.take || build(:period_scheduler) } - association :customer - end -end diff --git a/spec/factories/reports/interval_cdr.rb b/spec/factories/reports/interval_cdr.rb deleted file mode 100644 index ee82b68d2..000000000 --- a/spec/factories/reports/interval_cdr.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: reports.cdr_interval_report -# -# id :integer not null, primary key -# date_start :datetime not null -# date_end :datetime not null -# filter :string -# group_by :string -# created_at :datetime not null -# interval_length :integer not null -# aggregator_id :integer not null -# aggregate_by :string not null -# - -FactoryBot.define do - factory :interval_cdr, class: Report::IntervalCdr do - date_start { Time.now.utc } - date_end { Time.now.utc + 1.week } - interval_length { 10 } - group_by { %w[disconnect_initiator_id] } - aggregator_id { Report::IntervalAggregator.take.id } - aggregate_by { 'destination_fee' } - end -end diff --git a/spec/factories/reports/interval_data.rb b/spec/factories/reports/interval_data.rb deleted file mode 100644 index 298ef6823..000000000 --- a/spec/factories/reports/interval_data.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :interval_data, class: Report::IntervalData do - report { association :interval_cdr } - disconnect_initiator_id { 1 } - end -end diff --git a/spec/factories/reports/realtime/bad_routing.rb b/spec/factories/reports/realtime/bad_routing.rb deleted file mode 100644 index 115005dd2..000000000 --- a/spec/factories/reports/realtime/bad_routing.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :bad_routing, class: Report::Realtime::BadRouting, parent: :cdr do - time_start { 110.seconds.ago } # this record will be available in page during 10 second - disconnect_initiator_id { Cdr::Cdr::DISCONNECT_INITIATOR_ROUTING } - association :customer_auth, factory: :customers_auth - end -end diff --git a/spec/factories/reports/realtime/not_authenticated.rb b/spec/factories/reports/realtime/not_authenticated.rb deleted file mode 100644 index c785045d2..000000000 --- a/spec/factories/reports/realtime/not_authenticated.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :not_authenticated, class: Report::Realtime::NotAuthenticated, parent: :cdr do - time_start { 110.seconds.ago.utc } # this record will be available in page during 10 second - auth_orig_ip { IPAddr.new(rand(2**32), Socket::AF_INET) } - customer_auth_id { nil } - end -end diff --git a/spec/factories/reports/vendor_traffic_scheduler.rb b/spec/factories/reports/vendor_traffic_scheduler.rb deleted file mode 100644 index 40b1cc457..000000000 --- a/spec/factories/reports/vendor_traffic_scheduler.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: reports.vendor_traffic_report_schedulers -# -# id :integer not null, primary key -# created_at :datetime -# period_id :integer not null -# vendor_id :integer not null -# send_to :integer is an Array -# last_run_at :datetime -# next_run_at :datetime -# - -FactoryBot.define do - factory :vendor_traffic_scheduler, class: Report::VendorTrafficScheduler do - period { Report::SchedulerPeriod.take } - vendor - end -end diff --git a/spec/factories/routing/area_prefix.rb b/spec/factories/routing/area_prefix.rb deleted file mode 100644 index d77e09b68..000000000 --- a/spec/factories/routing/area_prefix.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :area_prefix, class: Routing::AreaPrefix do - sequence(:prefix) { |n| "#{n}#{n + 1}#{n + 2}" } # example: '123', '234'... - - association :area - end -end diff --git a/spec/factories/routing/area_prefixes.rb b/spec/factories/routing/area_prefixes.rb new file mode 100644 index 000000000..07262ba39 --- /dev/null +++ b/spec/factories/routing/area_prefixes.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.area_prefixes +# +# id :bigint(8) not null, primary key +# prefix :string not null +# area_id :integer(4) not null +# +# Indexes +# +# area_prefixes_prefix_key (prefix) UNIQUE +# +# Foreign Keys +# +# area_prefixes_area_id_fkey (area_id => areas.id) +# +FactoryBot.define do + factory :area_prefix, class: Routing::AreaPrefix do + sequence(:prefix) { |n| "#{n}#{n + 1}#{n + 2}" } # example: '123', '234'... + + association :area + end +end diff --git a/spec/factories/routing/area.rb b/spec/factories/routing/areas.rb similarity index 66% rename from spec/factories/routing/area.rb rename to spec/factories/routing/areas.rb index ff5cb181d..2ee413553 100644 --- a/spec/factories/routing/area.rb +++ b/spec/factories/routing/areas.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: class4.areas +# +# id :integer(4) not null, primary key +# name :string not null +# +# Indexes +# +# areas_name_key (name) UNIQUE +# FactoryBot.define do factory :area, class: Routing::Area do sequence(:name) { |n| "Routing_Area_#{n}" } diff --git a/spec/factories/routing/destination.rb b/spec/factories/routing/destination.rb deleted file mode 100644 index a853f9b1d..000000000 --- a/spec/factories/routing/destination.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :destination, aliases: [:rate], class: Routing::Destination do - sequence(:external_id) - prefix { nil } - connect_fee { 0 } - enabled { true } - reverse_billing { false } - reject_calls { false } - initial_interval { 60 } - next_interval { 60 } - initial_rate { 0 } - next_rate { 0 } - rate_policy_id { 1 } - dp_margin_fixed { 0 } - dp_margin_percent { 0 } - use_dp_intervals { false } - valid_from { 1.day.ago.utc } - valid_till { 1.day.from_now.utc } - profit_control_mode_id { Routing::RateProfitControlMode::MODE_PER_CALL } - - association :rate_group - - trait :with_uuid do - uuid { SecureRandom.uuid } - end - - trait :filled do - with_uuid - end - end -end diff --git a/spec/factories/routing/destination_next_rate.rb b/spec/factories/routing/destination_next_rate.rb deleted file mode 100644 index 895a86249..000000000 --- a/spec/factories/routing/destination_next_rate.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :destination_next_rate, class: Routing::DestinationNextRate do - initial_rate { 0 } - next_rate { 0 } - initial_interval { 5 } - next_interval { 10 } - connect_fee { 0 } - apply_time { 1.hour.from_now } - applied { false } - - association :destination - - trait :random do - initial_rate { 0.04 + rand.round(2) } - next_rate { 0.05 + rand.round(2) } - connect_fee { 0.06 + rand.round(2) } - initial_interval { rand(90..149) } - next_interval { rand(120..179) } - end - end -end diff --git a/spec/factories/routing/destination_next_rates.rb b/spec/factories/routing/destination_next_rates.rb new file mode 100644 index 000000000..e722f6d26 --- /dev/null +++ b/spec/factories/routing/destination_next_rates.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.destination_next_rates +# +# id :bigint(8) not null, primary key +# applied :boolean default(FALSE), not null +# apply_time :timestamptz +# connect_fee :decimal(, ) not null +# initial_interval :integer(2) not null +# initial_rate :decimal(, ) not null +# next_interval :integer(2) not null +# next_rate :decimal(, ) not null +# created_at :timestamptz +# updated_at :timestamptz +# destination_id :bigint(8) not null +# external_id :bigint(8) +# +# Foreign Keys +# +# destination_next_rates_destination_id_fkey (destination_id => destinations.id) +# +FactoryBot.define do + factory :destination_next_rate, class: Routing::DestinationNextRate do + initial_rate { 0 } + next_rate { 0 } + initial_interval { 5 } + next_interval { 10 } + connect_fee { 0 } + apply_time { 1.hour.from_now } + applied { false } + + association :destination + + trait :random do + initial_rate { 0.04 + rand.round(2) } + next_rate { 0.05 + rand.round(2) } + connect_fee { 0.06 + rand.round(2) } + initial_interval { rand(90..149) } + next_interval { rand(120..179) } + end + end +end diff --git a/spec/factories/routing/destinations.rb b/spec/factories/routing/destinations.rb new file mode 100644 index 000000000..eff41e6a5 --- /dev/null +++ b/spec/factories/routing/destinations.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.destinations +# +# id :bigint(8) not null, primary key +# acd_limit :float default(0.0), not null +# allow_package_billing :boolean default(FALSE), not null +# asr_limit :float default(0.0), not null +# connect_fee :decimal(, ) default(0.0) +# dp_margin_fixed :decimal(, ) default(0.0), not null +# dp_margin_percent :decimal(, ) default(0.0), not null +# dst_number_max_length :integer(2) default(100), not null +# dst_number_min_length :integer(2) default(0), not null +# enabled :boolean not null +# initial_interval :integer(4) default(1), not null +# initial_rate :decimal(, ) not null +# next_interval :integer(4) default(1), not null +# next_rate :decimal(, ) not null +# prefix :string not null +# quality_alarm :boolean default(FALSE), not null +# reject_calls :boolean default(FALSE), not null +# reverse_billing :boolean default(FALSE), not null +# routing_tag_ids :integer(2) default([]), not null, is an Array +# short_calls_limit :float default(0.0), not null +# use_dp_intervals :boolean default(FALSE), not null +# uuid :uuid not null +# valid_from :timestamptz not null +# valid_till :timestamptz not null +# external_id :bigint(8) +# network_prefix_id :integer(4) +# profit_control_mode_id :integer(2) +# rate_group_id :integer(4) not null +# rate_policy_id :integer(4) default(1), not null +# routing_tag_mode_id :integer(2) default(0), not null +# +# Indexes +# +# destinations_prefix_range_idx (((prefix)::prefix_range)) USING gist +# destinations_uuid_key (uuid) UNIQUE +# +# Foreign Keys +# +# destinations_rate_group_id_fkey (rate_group_id => rate_groups.id) +# destinations_routing_tag_mode_id_fkey (routing_tag_mode_id => routing_tag_modes.id) +# +FactoryBot.define do + factory :destination, aliases: [:rate], class: Routing::Destination do + sequence(:external_id) + prefix { nil } + connect_fee { 0 } + enabled { true } + reverse_billing { false } + reject_calls { false } + initial_interval { 60 } + next_interval { 60 } + initial_rate { 0 } + next_rate { 0 } + rate_policy_id { 1 } + dp_margin_fixed { 0 } + dp_margin_percent { 0 } + use_dp_intervals { false } + valid_from { 1.day.ago.utc } + valid_till { 1.day.from_now.utc } + profit_control_mode_id { Routing::RateProfitControlMode::MODE_PER_CALL } + + association :rate_group + + trait :with_uuid do + uuid { SecureRandom.uuid } + end + + trait :filled do + with_uuid + end + end +end diff --git a/spec/factories/routing/numberlist.rb b/spec/factories/routing/numberlist.rb deleted file mode 100644 index 0f99b9de6..000000000 --- a/spec/factories/routing/numberlist.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :numberlist, class: Routing::Numberlist do - sequence(:name) { |n| "numberlist#{n}" } - - association :lua_script - - mode_id { Routing::Numberlist::MODE_STRICT } - default_action_id { Routing::Numberlist::DEFAULT_ACTION_REJECT } - - trait :filled do - tag_action { Routing::TagAction.take } - end - - trait :with_external_id do - sequence(:external_id) - end - end -end diff --git a/spec/factories/routing/numberlist_item.rb b/spec/factories/routing/numberlist_item.rb deleted file mode 100644 index fc7a0b89f..000000000 --- a/spec/factories/routing/numberlist_item.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :numberlist_item, class: Routing::NumberlistItem do - sequence(:key) { |n| "numberlist_item_#{n}" } - - association :numberlist - association :lua_script - - action_id { Routing::NumberlistItem::ACTION_REJECT } - - trait :filled do - tag_action { Routing::TagAction.take } - end - end -end diff --git a/spec/factories/routing/numberlist_items.rb b/spec/factories/routing/numberlist_items.rb new file mode 100644 index 000000000..37814536a --- /dev/null +++ b/spec/factories/routing/numberlist_items.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.numberlist_items +# +# id :integer(4) not null, primary key +# defer_dst_rewrite :boolean default(FALSE), not null +# defer_src_rewrite :boolean default(FALSE), not null +# dst_rewrite_result :string +# dst_rewrite_rule :string +# key :string not null +# number_max_length :integer(2) default(100), not null +# number_min_length :integer(2) default(0), not null +# src_rewrite_result :string +# src_rewrite_rule :string +# tag_action_value :integer(2) default([]), not null, is an Array +# created_at :timestamptz +# updated_at :timestamptz +# action_id :integer(2) +# lua_script_id :integer(2) +# numberlist_id :integer(2) not null +# tag_action_id :integer(2) +# +# Indexes +# +# blacklist_items_blacklist_id_key_idx (numberlist_id,key) UNIQUE +# numberlist_items_prefix_range_idx (((key)::prefix_range)) USING gist +# +# Foreign Keys +# +# blacklist_items_blacklist_id_fkey (numberlist_id => numberlists.id) +# numberlist_items_lua_script_id_fkey (lua_script_id => lua_scripts.id) +# numberlist_items_tag_action_id_fkey (tag_action_id => tag_actions.id) +# +FactoryBot.define do + factory :numberlist_item, class: Routing::NumberlistItem do + sequence(:key) { |n| "numberlist_item_#{n}" } + + association :numberlist + association :lua_script + + action_id { Routing::NumberlistItem::ACTION_REJECT } + + trait :filled do + tag_action { Routing::TagAction.take } + end + end +end diff --git a/spec/factories/routing/numberlists.rb b/spec/factories/routing/numberlists.rb new file mode 100644 index 000000000..b52ae776e --- /dev/null +++ b/spec/factories/routing/numberlists.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.numberlists +# +# id :integer(2) not null, primary key +# default_dst_rewrite_result :string +# default_dst_rewrite_rule :string +# default_src_rewrite_result :string +# default_src_rewrite_rule :string +# defer_dst_rewrite :boolean default(FALSE), not null +# defer_src_rewrite :boolean default(FALSE), not null +# external_type :string +# name :string not null +# tag_action_value :integer(2) default([]), not null, is an Array +# created_at :timestamptz +# updated_at :timestamptz +# default_action_id :integer(2) default(1), not null +# external_id :bigint(8) +# lua_script_id :integer(2) +# mode_id :integer(2) default(1), not null +# tag_action_id :integer(2) +# +# Indexes +# +# blacklists_name_key (name) UNIQUE +# numberlists_external_id_external_type_key_uniq (external_id,external_type) UNIQUE +# numberlists_external_id_key_uniq (external_id) UNIQUE WHERE (external_type IS NULL) +# +# Foreign Keys +# +# numberlists_lua_script_id_fkey (lua_script_id => lua_scripts.id) +# numberlists_tag_action_id_fkey (tag_action_id => tag_actions.id) +# +FactoryBot.define do + factory :numberlist, class: Routing::Numberlist do + sequence(:name) { |n| "numberlist#{n}" } + + association :lua_script + + mode_id { Routing::Numberlist::MODE_STRICT } + default_action_id { Routing::Numberlist::DEFAULT_ACTION_REJECT } + + trait :filled do + tag_action { Routing::TagAction.take } + end + + trait :with_external_id do + sequence(:external_id) + end + end +end diff --git a/spec/factories/routing/rate_group.rb b/spec/factories/routing/rate_group.rb deleted file mode 100644 index 27857e97e..000000000 --- a/spec/factories/routing/rate_group.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :rate_group, class: Routing::RateGroup do - sequence(:name) { |n| "rateplan#{n}" } - sequence(:external_id) - - trait :filled do - destinations { build_list :destination, 2 } - end - end -end diff --git a/spec/factories/routing/rate_groups.rb b/spec/factories/routing/rate_groups.rb new file mode 100644 index 000000000..a7089f20f --- /dev/null +++ b/spec/factories/routing/rate_groups.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.rate_groups +# +# id :integer(4) not null, primary key +# name :string not null +# external_id :bigint(8) +# +# Indexes +# +# rate_groups_external_id_key (external_id) UNIQUE +# rate_groups_name_key (name) UNIQUE +# +FactoryBot.define do + factory :rate_group, class: Routing::RateGroup do + sequence(:name) { |n| "rateplan#{n}" } + sequence(:external_id) + + trait :filled do + destinations { build_list :destination, 2 } + end + end +end diff --git a/spec/factories/routing/rateplan.rb b/spec/factories/routing/rateplans.rb similarity index 55% rename from spec/factories/routing/rateplan.rb rename to spec/factories/routing/rateplans.rb index 660541c88..2905e5c25 100644 --- a/spec/factories/routing/rateplan.rb +++ b/spec/factories/routing/rateplans.rb @@ -1,5 +1,22 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: class4.rateplans +# +# id :integer(4) not null, primary key +# name :string +# send_quality_alarms_to :integer(4) is an Array +# uuid :uuid not null +# external_id :bigint(8) +# profit_control_mode_id :integer(2) default(1), not null +# +# Indexes +# +# rateplans_external_id_key (external_id) UNIQUE +# rateplans_name_unique (name) UNIQUE +# rateplans_uuid_key (uuid) UNIQUE +# FactoryBot.define do factory :rateplan, class: Routing::Rateplan do sequence(:name) { |n| "rateplan#{n}" } diff --git a/spec/factories/routing/routeset_discriminator.rb b/spec/factories/routing/routeset_discriminator.rb deleted file mode 100644 index 6bdc01565..000000000 --- a/spec/factories/routing/routeset_discriminator.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :routeset_discriminator, class: Routing::RoutesetDiscriminator do - sequence(:name) { |n| "Discriminator #{n}" } - end -end diff --git a/spec/factories/routing/routeset_discriminators.rb b/spec/factories/routing/routeset_discriminators.rb new file mode 100644 index 000000000..52c7ef6f6 --- /dev/null +++ b/spec/factories/routing/routeset_discriminators.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.routeset_discriminators +# +# id :integer(2) not null, primary key +# name :string not null +# +# Indexes +# +# routeset_discriminators_name_key (name) UNIQUE +# +FactoryBot.define do + factory :routeset_discriminator, class: Routing::RoutesetDiscriminator do + sequence(:name) { |n| "Discriminator #{n}" } + end +end diff --git a/spec/factories/routing/routing_group.rb b/spec/factories/routing/routing_groups.rb similarity index 54% rename from spec/factories/routing/routing_group.rb rename to spec/factories/routing/routing_groups.rb index 218e0acbf..3ba764e48 100644 --- a/spec/factories/routing/routing_group.rb +++ b/spec/factories/routing/routing_groups.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: class4.routing_groups +# +# id :integer(4) not null, primary key +# name :string not null +# +# Indexes +# +# routing_groups_name_unique (name) UNIQUE +# FactoryBot.define do factory :routing_group, class: Routing::RoutingGroup do sequence(:name) { |n| "routing_group_#{n}" } diff --git a/spec/factories/routing/routing_plan.rb b/spec/factories/routing/routing_plan.rb deleted file mode 100644 index 468359e48..000000000 --- a/spec/factories/routing/routing_plan.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :routing_plan, class: Routing::RoutingPlan do - sequence(:name) { |n| "routing_plan_#{n}" } - sorting_id { Routing::RoutingPlan::SORTING_LCR_PRIO_CONTROL } - rate_delta_max { 0 } - max_rerouting_attempts { 9 } - use_lnp { false } - validate_dst_number_format { false } - validate_dst_number_network { false } - validate_src_number_format { false } - validate_src_number_network { false } - - trait :with_static_routes do - sorting_id { Routing::RoutingPlan::SORTING_STATIC_LCR_CONTROL } - end - - trait :filled do - after(:create) do |record| - FactoryBot.create_list(:customers_auth, 2, routing_plan: record) - FactoryBot.create_list(:routing_group, 2, routing_plans: [record]) - end - end - end -end diff --git a/spec/factories/routing/routing_plan_lnp_rule.rb b/spec/factories/routing/routing_plan_lnp_rule.rb deleted file mode 100644 index 50e600ae0..000000000 --- a/spec/factories/routing/routing_plan_lnp_rule.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: class4.routing_plan_lnp_rules -# -# id :integer not null, primary key -# routing_plan_id :integer not null -# dst_prefix :string default(""), not null -# database_id :integer not null -# created_at :datetime -# lrn_rewrite_rule :string -# lrn_rewrite_result :string -# req_dst_rewrite_rule :string -# req_dst_rewrite_result :string -# - -FactoryBot.define do - factory :lnp_routing_plan_lnp_rule, class: Lnp::RoutingPlanLnpRule do - association :routing_plan, factory: :routing_plan - database { create(:lnp_database, :thinq) } - end -end diff --git a/spec/factories/routing/routing_plan_static_route.rb b/spec/factories/routing/routing_plan_static_route.rb deleted file mode 100644 index b4808f2f8..000000000 --- a/spec/factories/routing/routing_plan_static_route.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :routing_plan_static_route, class: Routing::RoutingPlanStaticRoute do - prefix { '' } - end -end diff --git a/spec/factories/routing/routing_plan_static_routes.rb b/spec/factories/routing/routing_plan_static_routes.rb new file mode 100644 index 000000000..dffa9e2f1 --- /dev/null +++ b/spec/factories/routing/routing_plan_static_routes.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.routing_plan_static_routes +# +# id :integer(4) not null, primary key +# prefix :string default(""), not null +# priority :integer(2) default(100), not null +# weight :integer(2) default(100), not null +# network_prefix_id :integer(4) +# routing_plan_id :integer(4) not null +# vendor_id :integer(4) not null +# +# Indexes +# +# routing_plan_static_routes_prefix_range_vendor_id_routing_p_idx (((prefix)::prefix_range), vendor_id, routing_plan_id) USING gist +# routing_plan_static_routes_vendor_id_idx (vendor_id) +# +# Foreign Keys +# +# routing_plan_static_routes_routing_plan_id_fkey (routing_plan_id => routing_plans.id) +# routing_plan_static_routes_vendor_id_fkey (vendor_id => contractors.id) +# +FactoryBot.define do + factory :routing_plan_static_route, class: Routing::RoutingPlanStaticRoute do + prefix { '' } + routing_plan { create :routing_plan, :with_static_routes } + + trait :filled do + network_prefix { FactoryBot.create :network_prefix } + end + end +end diff --git a/spec/factories/routing/routing_plans.rb b/spec/factories/routing/routing_plans.rb new file mode 100644 index 000000000..d627233a8 --- /dev/null +++ b/spec/factories/routing/routing_plans.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.routing_plans +# +# id :integer(4) not null, primary key +# max_rerouting_attempts :integer(2) default(10), not null +# name :string not null +# rate_delta_max :decimal(, ) default(0.0), not null +# use_lnp :boolean default(FALSE), not null +# validate_dst_number_format :boolean default(FALSE), not null +# validate_dst_number_network :boolean default(FALSE), not null +# validate_src_number_format :boolean default(FALSE), not null +# validate_src_number_network :boolean default(FALSE), not null +# dst_numberlist_id :integer(2) +# external_id :bigint(8) +# sorting_id :integer(4) default(1), not null +# src_numberlist_id :integer(2) +# +# Indexes +# +# routing_plans_dst_numberlist_id_idx (dst_numberlist_id) +# routing_plans_external_id_key (external_id) UNIQUE +# routing_plans_name_key (name) UNIQUE +# routing_plans_src_numberlist_id_idx (src_numberlist_id) +# +# Foreign Keys +# +# routing_plans_dst_numberlist_id_fkey (dst_numberlist_id => numberlists.id) +# routing_plans_src_numberlist_id_fkey (src_numberlist_id => numberlists.id) +# +FactoryBot.define do + factory :routing_plan, class: Routing::RoutingPlan do + sequence(:name) { |n| "routing_plan_#{n}" } + sorting_id { Routing::RoutingPlan::SORTING_LCR_PRIO_CONTROL } + rate_delta_max { 0 } + max_rerouting_attempts { 9 } + use_lnp { false } + validate_dst_number_format { false } + validate_dst_number_network { false } + validate_src_number_format { false } + validate_src_number_network { false } + + trait :with_static_routes do + sorting_id { Routing::RoutingPlan::SORTING_STATIC_LCR_CONTROL } + end + + trait :filled do + after(:create) do |record| + FactoryBot.create_list(:customers_auth, 2, routing_plan: record) + FactoryBot.create_list(:routing_group, 2, routing_plans: [record]) + end + end + end +end diff --git a/spec/factories/routing/routing_tag_detection_rule.rb b/spec/factories/routing/routing_tag_detection_rule.rb deleted file mode 100644 index d4dc94be3..000000000 --- a/spec/factories/routing/routing_tag_detection_rule.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: class4.routing_tag_detection_rules -# -# id :integer not null, primary key -# dst_area_id :integer -# src_area_id :integer -# tag_action_id :integer -# tag_action_value :integer default([]), not null, is an Array -# routing_tag_ids :integer default([]), not null, is an Array -# routing_tag_mode_id :integer default(0), not null -# src_prefix :string default(""), not null -# dst_prefix :string default(""), not null -# - -FactoryBot.define do - factory :routing_tag_detection_rule, class: Routing::RoutingTagDetectionRule do - tag_action { Routing::TagAction.clear_action } - - trait :filled do - association :src_area, factory: :area - routing_tag_mode_id { Routing::RoutingTagMode.take.id } - end - end -end diff --git a/spec/factories/routing/routing_tag_detection_rules.rb b/spec/factories/routing/routing_tag_detection_rules.rb new file mode 100644 index 000000000..11d2c8120 --- /dev/null +++ b/spec/factories/routing/routing_tag_detection_rules.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: class4.routing_tag_detection_rules +# +# id :integer(2) not null, primary key +# dst_prefix :string default(""), not null +# routing_tag_ids :integer(2) default([]), not null, is an Array +# src_prefix :string default(""), not null +# tag_action_value :integer(2) default([]), not null, is an Array +# dst_area_id :integer(4) +# routing_tag_mode_id :integer(2) default(0), not null +# src_area_id :integer(4) +# tag_action_id :integer(2) +# +# Indexes +# +# routing_tag_detection_rules_prefix_range_idx (((src_prefix)::prefix_range), ((dst_prefix)::prefix_range)) USING gist +# +# Foreign Keys +# +# routing_tag_detection_rules_dst_area_id_fkey (dst_area_id => areas.id) +# routing_tag_detection_rules_routing_tag_mode_id_fkey (routing_tag_mode_id => routing_tag_modes.id) +# routing_tag_detection_rules_src_area_id_fkey (src_area_id => areas.id) +# routing_tag_detection_rules_tag_action_id_fkey (tag_action_id => tag_actions.id) +# + +FactoryBot.define do + factory :routing_tag_detection_rule, class: Routing::RoutingTagDetectionRule do + tag_action { Routing::TagAction.clear_action } + + trait :filled do + association :src_area, factory: :area + routing_tag_mode_id { Routing::RoutingTagMode.take.id } + end + end +end diff --git a/spec/factories/routing/routing_tag.rb b/spec/factories/routing/routing_tags.rb similarity index 65% rename from spec/factories/routing/routing_tag.rb rename to spec/factories/routing/routing_tags.rb index 0d0cb8aab..1647007d9 100644 --- a/spec/factories/routing/routing_tag.rb +++ b/spec/factories/routing/routing_tags.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: class4.routing_tags +# +# id :integer(2) not null, primary key +# name :string not null +# +# Indexes +# +# routing_tags_name_key (name) UNIQUE +# FactoryBot.define do factory :routing_tag, class: Routing::RoutingTag do sequence(:name) { |n| "TAG_#{n}" } diff --git a/spec/factories/routing/static_route.rb b/spec/factories/routing/static_route.rb deleted file mode 100644 index 88db715ce..000000000 --- a/spec/factories/routing/static_route.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :static_route, class: Routing::RoutingPlanStaticRoute do - routing_plan { create :routing_plan, :with_static_routes } - vendor { FactoryBot.create :vendor } - - trait :filled do - network_prefix { FactoryBot.create :network_prefix } - end - end -end diff --git a/spec/factories/routing/tag_action.rb b/spec/factories/routing/tag_actions.rb similarity index 73% rename from spec/factories/routing/tag_action.rb rename to spec/factories/routing/tag_actions.rb index c984aee3b..5c0982f67 100644 --- a/spec/factories/routing/tag_action.rb +++ b/spec/factories/routing/tag_actions.rb @@ -4,9 +4,13 @@ # # Table name: class4.tag_actions # -# id :integer not null, primary key +# id :integer(2) not null, primary key # name :string not null # +# Indexes +# +# tag_actions_name_key (name) UNIQUE +# FactoryBot.define do factory :tag_action, class: Routing::TagAction do diff --git a/spec/factories/rtp_statistics/rx_stream.rb b/spec/factories/rtp_statistics/rx_streams.rb similarity index 50% rename from spec/factories/rtp_statistics/rx_stream.rb rename to spec/factories/rtp_statistics/rx_streams.rb index f6c321685..1a48a5f22 100644 --- a/spec/factories/rtp_statistics/rx_stream.rb +++ b/spec/factories/rtp_statistics/rx_streams.rb @@ -1,5 +1,42 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: rtp_statistics.rx_streams +# +# id :bigint(8) not null, primary key +# local_host :inet +# local_port :integer(4) +# local_tag :string +# remote_host :inet +# remote_port :integer(4) +# rx_bytes :bigint(8) +# rx_decode_errors :bigint(8) +# rx_packet_delta_max :float +# rx_packet_delta_mean :float +# rx_packet_delta_min :float +# rx_packet_delta_std :float +# rx_packet_jitter_max :float +# rx_packet_jitter_mean :float +# rx_packet_jitter_min :float +# rx_packet_jitter_std :float +# rx_packets :bigint(8) +# rx_payloads_relayed :string is an Array +# rx_payloads_transcoded :string is an Array +# rx_rtcp_jitter_max :float +# rx_rtcp_jitter_mean :float +# rx_rtcp_jitter_min :float +# rx_rtcp_jitter_std :float +# rx_ssrc :bigint(8) +# rx_total_lost :bigint(8) +# time_end :timestamptz +# time_start :timestamptz not null +# gateway_external_id :bigint(8) +# gateway_id :bigint(8) +# node_id :integer(4) +# pop_id :integer(4) +# tx_stream_id :bigint(8) +# FactoryBot.define do factory :rx_stream, class: RtpStatistics::RxStream do time_start { 1.minute.ago } diff --git a/spec/factories/rtp_statistics/tx_stream.rb b/spec/factories/rtp_statistics/tx_stream.rb deleted file mode 100644 index 795e32fce..000000000 --- a/spec/factories/rtp_statistics/tx_stream.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :tx_stream, class: RtpStatistics::TxStream do - time_start { 1.minute.ago } - time_end { 30.seconds.ago } - association :pop - association :node - association :gateway - gateway_external_id { 11 } - local_tag { SecureRandom.uuid } - - rtcp_rtt_min { 0.000001 } - rtcp_rtt_max { 0.000001 } - rtcp_rtt_mean { 0.000001 } - rtcp_rtt_std { 0.000001 } - rx_out_of_buffer_errors { 100 } - rx_rtp_parse_errors { 100 } - rx_dropped_packets { 100 } - tx_packets { 100 } - tx_bytes { 100 } - tx_ssrc { 10_023_323 } - local_host { '1.2.3.4' } - local_port { 65_535 } - tx_total_lost { 100 } - tx_payloads_transcoded { %w[pcmu pcma] } - tx_payloads_relayed { ['opus'] } - tx_rtcp_jitter_min { 0.000001 } - tx_rtcp_jitter_max { 0.000001 } - tx_rtcp_jitter_mean { 0.000001 } - tx_rtcp_jitter_std { 0.000001 } - - before(:create) do |record, _evaluator| - # Create partition for current+next monthes if not exists - RtpStatistics::TxStream.add_partition_for(record.time_start) - end - end -end diff --git a/spec/factories/rtp_statistics/tx_streams.rb b/spec/factories/rtp_statistics/tx_streams.rb new file mode 100644 index 000000000..9f9858fb6 --- /dev/null +++ b/spec/factories/rtp_statistics/tx_streams.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: rtp_statistics.tx_streams +# +# id :bigint(8) not null, primary key +# local_host :inet +# local_port :integer(4) +# local_tag :string not null +# rtcp_rtt_max :float +# rtcp_rtt_mean :float +# rtcp_rtt_min :float +# rtcp_rtt_std :float +# rx_dropped_packets :bigint(8) +# rx_out_of_buffer_errors :bigint(8) +# rx_rtp_parse_errors :bigint(8) +# rx_srtp_decrypt_errors :bigint(8) +# time_end :timestamptz +# time_start :timestamptz not null +# tx_bytes :bigint(8) +# tx_packets :bigint(8) +# tx_payloads_relayed :string is an Array +# tx_payloads_transcoded :string is an Array +# tx_rtcp_jitter_max :float +# tx_rtcp_jitter_mean :float +# tx_rtcp_jitter_min :float +# tx_rtcp_jitter_std :float +# tx_ssrc :bigint(8) +# tx_total_lost :integer(4) +# gateway_external_id :bigint(8) +# gateway_id :bigint(8) +# node_id :integer(4) +# pop_id :integer(4) +# +FactoryBot.define do + factory :tx_stream, class: RtpStatistics::TxStream do + time_start { 1.minute.ago } + time_end { 30.seconds.ago } + association :pop + association :node + association :gateway + gateway_external_id { 11 } + local_tag { SecureRandom.uuid } + + rtcp_rtt_min { 0.000001 } + rtcp_rtt_max { 0.000001 } + rtcp_rtt_mean { 0.000001 } + rtcp_rtt_std { 0.000001 } + rx_out_of_buffer_errors { 100 } + rx_rtp_parse_errors { 100 } + rx_dropped_packets { 100 } + tx_packets { 100 } + tx_bytes { 100 } + tx_ssrc { 10_023_323 } + local_host { '1.2.3.4' } + local_port { 65_535 } + tx_total_lost { 100 } + tx_payloads_transcoded { %w[pcmu pcma] } + tx_payloads_relayed { ['opus'] } + tx_rtcp_jitter_min { 0.000001 } + tx_rtcp_jitter_max { 0.000001 } + tx_rtcp_jitter_mean { 0.000001 } + tx_rtcp_jitter_std { 0.000001 } + + before(:create) do |record, _evaluator| + # Create partition for current+next monthes if not exists + RtpStatistics::TxStream.add_partition_for(record.time_start) + end + end +end diff --git a/spec/factories/sensor.rb b/spec/factories/sensor.rb deleted file mode 100644 index 6b4678458..000000000 --- a/spec/factories/sensor.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :sensor, class: System::Sensor do - sequence(:name) { |n| "sensor#{n}" } - mode_id { 1 } - source_interface { nil } - target_mac { nil } - source_ip { '192.168.0.1' } - target_ip { '192.168.0.2' } - - trait :filled do - gateways { build_list :gateway, 2 } - end - end -end diff --git a/spec/factories/stats/active_call_orig_gws.rb b/spec/factories/stats/active_call_orig_gateways.rb similarity index 94% rename from spec/factories/stats/active_call_orig_gws.rb rename to spec/factories/stats/active_call_orig_gateways.rb index 85de9392c..809ece329 100644 --- a/spec/factories/stats/active_call_orig_gws.rb +++ b/spec/factories/stats/active_call_orig_gateways.rb @@ -6,7 +6,7 @@ # # id :bigint(8) not null, primary key # count :integer(4) not null -# created_at :datetime +# created_at :timestamptz # gateway_id :integer(4) not null # diff --git a/spec/factories/stats/active_call_term_gws.rb b/spec/factories/stats/active_call_term_gateways.rb similarity index 94% rename from spec/factories/stats/active_call_term_gws.rb rename to spec/factories/stats/active_call_term_gateways.rb index 65dd9e04b..5c1d69ecd 100644 --- a/spec/factories/stats/active_call_term_gws.rb +++ b/spec/factories/stats/active_call_term_gateways.rb @@ -6,7 +6,7 @@ # # id :bigint(8) not null, primary key # count :integer(4) not null -# created_at :datetime +# created_at :timestamptz # gateway_id :integer(4) not null # diff --git a/spec/factories/quality_stat.rb b/spec/factories/stats/termination_quality_stats.rb similarity index 52% rename from spec/factories/quality_stat.rb rename to spec/factories/stats/termination_quality_stats.rb index 7c6b4fdbb..8d92cac56 100644 --- a/spec/factories/quality_stat.rb +++ b/spec/factories/stats/termination_quality_stats.rb @@ -4,15 +4,20 @@ # # Table name: stats.termination_quality_stats # -# id :integer not null, primary key -# dialpeer_id :integer -# gateway_id :integer -# time_start :datetime not null -# success :boolean not null -# duration :integer not null -# pdd :float +# id :bigint(8) not null, primary key +# duration :bigint(8) not null # early_media_present :boolean -# destination_id :integer +# pdd :float +# success :boolean not null +# time_start :timestamptz not null +# destination_id :bigint(8) +# dialpeer_id :bigint(8) +# gateway_id :integer(4) +# +# Indexes +# +# termination_quality_stats_dialpeer_id_idx (dialpeer_id) +# termination_quality_stats_gateway_id_idx (gateway_id) # FactoryBot.define do diff --git a/spec/factories/system/api_log_config.rb b/spec/factories/system/api_log_configs.rb similarity index 71% rename from spec/factories/system/api_log_config.rb rename to spec/factories/system/api_log_configs.rb index e86d2ddce..cb881c874 100644 --- a/spec/factories/system/api_log_config.rb +++ b/spec/factories/system/api_log_configs.rb @@ -4,9 +4,12 @@ # # Table name: sys.api_log_config # -# id :integer not null, primary key +# id :integer(4) not null, primary key # controller :string not null -# debug :boolean default(FALSE), not null +# +# Indexes +# +# api_log_config_controller_key (controller) UNIQUE # FactoryBot.define do diff --git a/spec/factories/system/background_test.rb b/spec/factories/system/background_test.rb deleted file mode 100644 index 8afa575cf..000000000 --- a/spec/factories/system/background_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: delayed_jobs -# -# id :integer not null, primary key -# priority :integer default(0), not null -# attempts :integer default(0), not null -# handler :text not null -# last_error :text -# run_at :datetime -# locked_at :datetime -# failed_at :datetime -# locked_by :string(255) -# queue :string(255) -# created_at :datetime not null -# updated_at :datetime not null -# - -FactoryBot.define do - factory :background_task, class: BackgroundTask do - priority { 0 } - attempts { 0 } - handler { "--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper\njob_data:\n job_class: Worker::CdrExportJob\n job_id: 71b02934-f68e-4a98-a90c-de8d274a37ed\n provider_job_id: \n queue_name: cdr_export\n priority: \n arguments:\n - 1\n executions: 0\n locale: en\n" } - end -end diff --git a/spec/factories/system/cdr_config.rb b/spec/factories/system/cdr_config.rb deleted file mode 100644 index b6bb650fe..000000000 --- a/spec/factories/system/cdr_config.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: sys.config -# -# id :integer not null, primary key -# call_duration_round_mode_id :integer default(1), not null -# customer_amount_round_mode_id :integer default(1), not null -# customer_amount_round_precision :integer default(5), not null -# vendor_amount_round_mode_id :integer default(1), not null -# vendor_amount_round_precision :integer default(5), not null -# - -FactoryBot.define do - factory :cdr_config, class: System::CdrConfig do - sequence(:id) { |n| n } - - call_duration_round_mode { System::CdrRoundMode.take || create(:cdr_round_mode, :always_up) } - customer_price_round_mode { System::CdrPriceRoundMode.take || create(:cdr_price_round_mode, :always_up) } - vendor_price_round_mode { System::CdrPriceRoundMode.take || create(:cdr_price_round_mode, :always_up) } - end -end diff --git a/spec/factories/system/cdr_configs.rb b/spec/factories/system/cdr_configs.rb new file mode 100644 index 000000000..ca3cbf54a --- /dev/null +++ b/spec/factories/system/cdr_configs.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: sys.config +# +# id :integer(2) not null, primary key +# customer_amount_round_precision :integer(2) default(5), not null +# disable_realtime_statistics :boolean default(FALSE), not null +# vendor_amount_round_precision :integer(2) default(5), not null +# call_duration_round_mode_id :integer(2) default(1), not null +# customer_amount_round_mode_id :integer(2) default(1), not null +# vendor_amount_round_mode_id :integer(2) default(1), not null +# +# Foreign Keys +# +# config_call_duration_round_mode_id_fkey (call_duration_round_mode_id => sys.call_duration_round_modes.id) +# config_customer_amount_round_mode_id_fkey (customer_amount_round_mode_id => sys.amount_round_modes.id) +# config_vendor_amount_round_mode_id_fkey (vendor_amount_round_mode_id => sys.amount_round_modes.id) +# +FactoryBot.define do + factory :cdr_config, class: System::CdrConfig do + sequence(:id) { |n| n } + + call_duration_round_mode { System::CdrRoundMode.take || create(:cdr_round_mode, :always_up) } + customer_price_round_mode { System::CdrPriceRoundMode.take || create(:cdr_price_round_mode, :always_up) } + vendor_price_round_mode { System::CdrPriceRoundMode.take || create(:cdr_price_round_mode, :always_up) } + end +end diff --git a/spec/factories/system/cdr_price_round_mode.rb b/spec/factories/system/cdr_price_round_modes.rb similarity index 77% rename from spec/factories/system/cdr_price_round_mode.rb rename to spec/factories/system/cdr_price_round_modes.rb index 7b6b5f001..36734b7ae 100644 --- a/spec/factories/system/cdr_price_round_mode.rb +++ b/spec/factories/system/cdr_price_round_modes.rb @@ -4,10 +4,13 @@ # # Table name: sys.amount_round_modes # -# id :integer not null, primary key +# id :integer(2) not null, primary key # name :string not null # - +# Indexes +# +# amount_round_modes_name_key (name) UNIQUE +# FactoryBot.define do factory :cdr_price_round_mode, class: System::CdrPriceRoundMode do sequence(:id, &:n) diff --git a/spec/factories/system/cdr_round_mode.rb b/spec/factories/system/cdr_round_modes.rb similarity index 82% rename from spec/factories/system/cdr_round_mode.rb rename to spec/factories/system/cdr_round_modes.rb index 75f7fe0cf..e05f6ac11 100644 --- a/spec/factories/system/cdr_round_mode.rb +++ b/spec/factories/system/cdr_round_modes.rb @@ -4,9 +4,13 @@ # # Table name: sys.call_duration_round_modes # -# id :integer not null, primary key +# id :integer(2) not null, primary key # name :string not null # +# Indexes +# +# call_duration_round_modes_name_key (name) UNIQUE +# FactoryBot.define do factory :cdr_round_mode, class: System::CdrRoundMode do diff --git a/spec/factories/system/country.rb b/spec/factories/system/countries.rb similarity index 65% rename from spec/factories/system/country.rb rename to spec/factories/system/countries.rb index 986fb87b7..97ea60c88 100644 --- a/spec/factories/system/country.rb +++ b/spec/factories/system/countries.rb @@ -1,5 +1,17 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: sys.countries +# +# id :integer(4) not null, primary key +# iso2 :string(2) not null +# name :string not null +# +# Indexes +# +# countries_name_key (name) UNIQUE +# FactoryBot.define do factory :country, class: System::Country do name { 'United States' } diff --git a/spec/factories/system/lnp_resolver.rb b/spec/factories/system/lnp_resolvers.rb similarity index 70% rename from spec/factories/system/lnp_resolver.rb rename to spec/factories/system/lnp_resolvers.rb index 2ab05e44a..9ce26b4ab 100644 --- a/spec/factories/system/lnp_resolver.rb +++ b/spec/factories/system/lnp_resolvers.rb @@ -4,10 +4,14 @@ # # Table name: sys.lnp_resolvers # -# id :integer not null, primary key -# name :string not null +# id :integer(4) not null, primary key # address :string not null -# port :integer not null +# name :string not null +# port :integer(4) not null +# +# Indexes +# +# lnp_resolvers_name_key (name) UNIQUE # FactoryBot.define do diff --git a/spec/factories/system/load_balacer.rb b/spec/factories/system/load_balacer.rb deleted file mode 100644 index 18b5d85d5..000000000 --- a/spec/factories/system/load_balacer.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :system_load_balancer, class: System::LoadBalancer do - name { 'TEST BALANCER' } - signalling_ip { '1.2.3.4' } - - trait :uniq do - sequence(:name) { |n| "TEST BALANCER_#{n}" } - sequence(:signalling_ip) { |n| "1.2.3.#{n}" } - end - end -end diff --git a/spec/factories/system/load_balancers.rb b/spec/factories/system/load_balancers.rb new file mode 100644 index 000000000..92a07da51 --- /dev/null +++ b/spec/factories/system/load_balancers.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: sys.load_balancers +# +# id :integer(2) not null, primary key +# name :string not null +# signalling_ip :string not null +# +# Indexes +# +# load_balancers_name_key (name) UNIQUE +# load_balancers_signalling_ip_key (signalling_ip) UNIQUE +# +FactoryBot.define do + factory :system_load_balancer, class: System::LoadBalancer do + name { 'TEST BALANCER' } + signalling_ip { '1.2.3.4' } + + trait :uniq do + sequence(:name) { |n| "TEST BALANCER_#{n}" } + sequence(:signalling_ip) { |n| "1.2.3.#{n}" } + end + end +end diff --git a/spec/factories/system/lua_script.rb b/spec/factories/system/lua_scripts.rb similarity index 63% rename from spec/factories/system/lua_script.rb rename to spec/factories/system/lua_scripts.rb index 07dde073d..f62999485 100644 --- a/spec/factories/system/lua_script.rb +++ b/spec/factories/system/lua_scripts.rb @@ -1,5 +1,19 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: sys.lua_scripts +# +# id :integer(2) not null, primary key +# name :string not null +# source :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# lua_scripts_name_key (name) UNIQUE +# FactoryBot.define do factory :lua_script, class: System::LuaScript do sequence(:name) { |n| "LUA script_#{n}" } diff --git a/spec/factories/system/network_prefix.rb b/spec/factories/system/network_prefix.rb deleted file mode 100644 index e93af36c5..000000000 --- a/spec/factories/system/network_prefix.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: sys.network_prefixes -# -# id :integer not null, primary key -# prefix :string not null, uniqueness -# network_id :integer not null, presence -# country_id :integer -# number_min_length :integer default(0), not null -# number_max_length :integer default(100), not null -# uuid :uuid not null -# - -FactoryBot.define do - factory :network_prefix, class: System::NetworkPrefix do - # Max prefix length in db/network_prefixes.yml is 12. - # To avoid duplication we create prefixes wih length 13+. - base_prefix = '1' * 12 - sequence(:prefix) { |n| base_prefix + n.to_s } - network { System::Network.take! } - country { System::Country.take! } - uuid { SecureRandom.uuid } - end -end diff --git a/spec/factories/system/network_prefixes.rb b/spec/factories/system/network_prefixes.rb new file mode 100644 index 000000000..b7ddfcb58 --- /dev/null +++ b/spec/factories/system/network_prefixes.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: sys.network_prefixes +# +# id :integer(4) not null, primary key +# number_max_length :integer(2) default(100), not null +# number_min_length :integer(2) default(0), not null +# prefix :string not null +# uuid :uuid not null +# country_id :integer(4) +# network_id :integer(4) +# +# Indexes +# +# network_prefixes_prefix_key (prefix) UNIQUE +# network_prefixes_prefix_range_idx (((prefix)::prefix_range)) USING gist +# network_prefixes_uuid_key (uuid) UNIQUE +# +# Foreign Keys +# +# network_prefixes_country_id_fkey (country_id => countries.id) +# network_prefixes_network_id_fkey (network_id => networks.id) +# + +FactoryBot.define do + factory :network_prefix, class: System::NetworkPrefix do + # Max prefix length in db/network_prefixes.yml is 12. + # To avoid duplication we create prefixes wih length 13+. + base_prefix = '1' * 12 + sequence(:prefix) { |n| base_prefix + n.to_s } + network { System::Network.take! } + country { System::Country.take! } + uuid { SecureRandom.uuid } + end +end diff --git a/spec/factories/system/network_type.rb b/spec/factories/system/network_type.rb deleted file mode 100644 index 77a640e0a..000000000 --- a/spec/factories/system/network_type.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :network_type, class: System::NetworkType do - sequence(:name) { |n| "Network type #{n}" } - uuid { SecureRandom.uuid } - - trait :filled do - networks { System::Network.take(2) } - end - end -end diff --git a/spec/factories/system/network_types.rb b/spec/factories/system/network_types.rb new file mode 100644 index 000000000..b6f101c8a --- /dev/null +++ b/spec/factories/system/network_types.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: sys.network_types +# +# id :integer(2) not null, primary key +# name :string not null +# uuid :uuid not null +# +# Indexes +# +# network_types_name_key (name) UNIQUE +# network_types_uuid_key (uuid) UNIQUE +# +FactoryBot.define do + factory :network_type, class: System::NetworkType do + sequence(:name) { |n| "Network type #{n}" } + uuid { SecureRandom.uuid } + + trait :filled do + networks { System::Network.take(2) } + end + end +end diff --git a/spec/factories/system/network.rb b/spec/factories/system/networks.rb similarity index 71% rename from spec/factories/system/network.rb rename to spec/factories/system/networks.rb index 31552e8c4..975aa34aa 100644 --- a/spec/factories/system/network.rb +++ b/spec/factories/system/networks.rb @@ -4,12 +4,20 @@ # # Table name: sys.networks # -# id :integer not null, primary key +# id :integer(4) not null, primary key # name :string not null -# type_id :integer not null # uuid :uuid not null +# type_id :integer(2) not null +# +# Indexes +# +# networks_name_key (name) UNIQUE +# networks_uuid_key (uuid) UNIQUE +# +# Foreign Keys +# +# networks_type_id_fkey (type_id => network_types.id) # - FactoryBot.define do factory :network, class: System::Network do name { 'US Eagle Mobile' } diff --git a/spec/factories/system/sensors.rb b/spec/factories/system/sensors.rb new file mode 100644 index 000000000..e420245af --- /dev/null +++ b/spec/factories/system/sensors.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: sys.sensors +# +# id :integer(2) not null, primary key +# name :string not null +# source_interface :string +# source_ip :inet +# target_ip :inet +# target_mac :macaddr +# target_port :integer(4) +# use_routing :boolean not null +# hep_capture_id :integer(4) +# mode_id :integer(4) not null +# +# Indexes +# +# sensors_name_key (name) UNIQUE +# +# Foreign Keys +# +# sensors_mode_id_fkey (mode_id => sensor_modes.id) +# +FactoryBot.define do + factory :sensor, class: System::Sensor do + sequence(:name) { |n| "sensor#{n}" } + mode_id { 1 } + source_interface { nil } + target_mac { nil } + source_ip { '192.168.0.1' } + target_ip { '192.168.0.2' } + + trait :filled do + gateways { build_list :gateway, 2 } + end + end +end diff --git a/spec/factories/system/smtp_connection.rb b/spec/factories/system/smtp_connection.rb deleted file mode 100644 index 5fd87fe43..000000000 --- a/spec/factories/system/smtp_connection.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -FactoryBot.define do - factory :smtp_connection, class: System::SmtpConnection do - sequence(:name) { |n| "smtp_connection#{n}" } - host { 'host' } - port { '25' } - from_address { 'address@email.com' } - global { true } - - trait :filled do - contractors { build_list :customer, 2 } - end - end -end diff --git a/spec/factories/system/smtp_connections.rb b/spec/factories/system/smtp_connections.rb new file mode 100644 index 000000000..79dd0eba9 --- /dev/null +++ b/spec/factories/system/smtp_connections.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: sys.smtp_connections +# +# id :integer(4) not null, primary key +# auth_password :string +# auth_type :string default("plain"), not null +# auth_user :string +# from_address :string not null +# global :boolean default(TRUE), not null +# host :string not null +# name :string not null +# port :integer(4) default(25), not null +# +# Indexes +# +# smtp_connections_name_key (name) UNIQUE +# +FactoryBot.define do + factory :smtp_connection, class: System::SmtpConnection do + sequence(:name) { |n| "smtp_connection#{n}" } + host { 'host' } + port { '25' } + from_address { 'address@email.com' } + global { true } + + trait :filled do + contractors { build_list :customer, 2 } + end + end +end diff --git a/spec/factories/system/timezone.rb b/spec/factories/system/timezones.rb similarity index 64% rename from spec/factories/system/timezone.rb rename to spec/factories/system/timezones.rb index 86cac9f68..8a8a88461 100644 --- a/spec/factories/system/timezone.rb +++ b/spec/factories/system/timezones.rb @@ -1,5 +1,19 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: sys.timezones +# +# id :integer(4) not null, primary key +# abbrev :string +# is_dst :boolean +# name :string not null +# utc_offset :interval +# +# Indexes +# +# timezones_name_key (name) UNIQUE +# FactoryBot.define do factory :timezone, class: System::Timezone do sequence(:name) { |n| "TZ#{n}" } diff --git a/spec/factories/termination_quality_stat.rb b/spec/factories/termination_quality_stat.rb deleted file mode 100644 index a0509ddb7..000000000 --- a/spec/factories/termination_quality_stat.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: stats.termination_quality_stats -# -# id :integer not null, primary key -# dialpeer_id :integer -# gateway_id :integer -# time_start :datetime not null -# success :boolean not null -# duration :integer not null -# pdd :float -# early_media_present :boolean -# destination_id :integer -# - -FactoryBot.define do - factory :termination_quality_stat, class: Stats::TerminationQualityStat do - time_start { Time.now.utc } - success { true } - duration { 2 } - - trait :filled do - dialpeer - gateway - end - end -end From 1897920988f557f0c7d9c485ad37c25f8a849059 Mon Sep 17 00:00:00 2001 From: Anton-Ivanov Date: Thu, 11 Jul 2024 14:31:25 +0300 Subject: [PATCH 2/4] disable Style/SymbolProc for "payment" factory --- spec/factories/payments.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/factories/payments.rb b/spec/factories/payments.rb index a31bb61f4..71870434b 100644 --- a/spec/factories/payments.rb +++ b/spec/factories/payments.rb @@ -32,7 +32,7 @@ status_id { Payment::CONST::STATUS_ID_COMPLETED } type_id { Payment::CONST::TYPE_ID_MANUAL } - after(:create) do |record| + after(:create) do |record| # rubocop:disable Style/SymbolProc record.reload # to populate uuid end From a6cacc4f6600ff0d51c90aff8c8c13c40d02350a Mon Sep 17 00:00:00 2001 From: Anton-Ivanov Date: Thu, 11 Jul 2024 14:23:24 +0300 Subject: [PATCH 3/4] add alias for routing_plan_static_route factory --- spec/factories/routing/routing_plan_static_routes.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/factories/routing/routing_plan_static_routes.rb b/spec/factories/routing/routing_plan_static_routes.rb index dffa9e2f1..5397e42a2 100644 --- a/spec/factories/routing/routing_plan_static_routes.rb +++ b/spec/factories/routing/routing_plan_static_routes.rb @@ -23,9 +23,10 @@ # routing_plan_static_routes_vendor_id_fkey (vendor_id => contractors.id) # FactoryBot.define do - factory :routing_plan_static_route, class: Routing::RoutingPlanStaticRoute do + factory :routing_plan_static_route, aliases: [:static_route], class: Routing::RoutingPlanStaticRoute do prefix { '' } routing_plan { create :routing_plan, :with_static_routes } + vendor { FactoryBot.create :vendor } trait :filled do network_prefix { FactoryBot.create :network_prefix } From e6168038bbf207385e16c8a35f89f7cad78c8e0e Mon Sep 17 00:00:00 2001 From: Anton-Ivanov Date: Mon, 15 Jul 2024 08:32:14 +0300 Subject: [PATCH 4/4] specify the "class" option for each factory in the project --- spec/factories/account_balance_notification_settings.rb | 2 +- spec/factories/accounts.rb | 2 +- spec/factories/active_calls.rb | 2 +- spec/factories/admin_users.rb | 2 +- spec/factories/api_access.rb | 2 +- spec/factories/audit_log_items.rb | 2 +- spec/factories/background_tasks.rb | 2 +- spec/factories/billing/contacts.rb | 2 +- spec/factories/billing/invoice_documents.rb | 2 +- spec/factories/billing/invoice_originated_destinations.rb | 2 +- spec/factories/billing/invoice_originated_networks.rb | 2 +- spec/factories/billing/invoice_service_data.rb | 2 +- spec/factories/billing/invoice_templates.rb | 2 +- spec/factories/billing/invoice_terminated_destinations.rb | 2 +- spec/factories/billing/invoice_terminated_networks.rb | 2 +- spec/factories/billing/invoices.rb | 2 +- spec/factories/billing/package_counters.rb | 2 +- spec/factories/billing/service_types.rb | 2 +- spec/factories/billing/services.rb | 2 +- spec/factories/billing/transactions.rb | 2 +- spec/factories/cdr/auth_logs.rb | 2 +- spec/factories/cdr/cdrs.rb | 2 +- spec/factories/cdr_exports.rb | 2 +- spec/factories/cnam/database_https.rb | 2 +- spec/factories/cnam/databases.rb | 2 +- spec/factories/codec_group_codec.rb | 2 +- spec/factories/codec_groups.rb | 2 +- spec/factories/contractors.rb | 2 +- spec/factories/cron_job_infos.rb | 2 +- spec/factories/customers_auths.rb | 2 +- spec/factories/dialpeer_next_rates.rb | 2 +- spec/factories/dialpeers.rb | 2 +- spec/factories/disconnect_codes.rb | 2 +- spec/factories/disconnect_policy.rb | 2 +- spec/factories/disconnect_policy_code.rb | 2 +- .../equipment/radius/accounting_profile_start_attributes.rb | 2 +- .../equipment/radius/accounting_profile_stop_attributes.rb | 2 +- spec/factories/equipment/radius/accounting_profiles.rb | 2 +- spec/factories/equipment/radius/auth_profiles.rb | 2 +- spec/factories/equipment/registrations.rb | 2 +- spec/factories/equipment/sip_options_probers.rb | 2 +- spec/factories/equipment/stir_shaken/signing_certificates.rb | 2 +- spec/factories/equipment/stir_shaken/trusted_certificates.rb | 2 +- spec/factories/equipment/stir_shaken/trusted_repositories.rb | 2 +- spec/factories/events.rb | 2 +- spec/factories/gateway_groups.rb | 2 +- spec/factories/gateways.rb | 2 +- spec/factories/gateways_stats.rb | 2 +- spec/factories/importing/accounts.rb | 2 +- spec/factories/importing/contractors.rb | 2 +- spec/factories/importing/customers_auths.rb | 2 +- spec/factories/importing/destinations.rb | 2 +- spec/factories/importing/dialpeers.rb | 2 +- spec/factories/importing/disconnect_policies.rb | 2 +- spec/factories/importing/gateway_groups.rb | 2 +- spec/factories/importing/gateways.rb | 2 +- spec/factories/importing/numberlist_items.rb | 2 +- spec/factories/importing/numberlists.rb | 2 +- spec/factories/importing/rateplans.rb | 2 +- spec/factories/importing/registrations.rb | 2 +- spec/factories/importing/routing_groups.rb | 2 +- spec/factories/importing/routing_tag_detection_rules.rb | 2 +- spec/factories/incoming_registrations.rb | 2 +- spec/factories/lnp/caches.rb | 2 +- spec/factories/lnp/databases.rb | 2 +- spec/factories/lnp/routing_plan_lnp_rules.rb | 2 +- spec/factories/log/api_logs.rb | 2 +- spec/factories/log/balance_notifications.rb | 2 +- spec/factories/log/email_logs.rb | 2 +- spec/factories/logic_logs.rb | 2 +- spec/factories/nodes.rb | 2 +- spec/factories/notification/attachments.rb | 2 +- spec/factories/outgoing_registrations.rb | 2 +- spec/factories/payments.rb | 2 +- spec/factories/pops.rb | 2 +- spec/factories/realtime_sip_options_probers.rb | 2 +- spec/factories/report/custom_cdr_schedulers.rb | 2 +- spec/factories/report/custom_cdrs.rb | 2 +- spec/factories/report/custom_data.rb | 2 +- spec/factories/report/customer_traffic_schedulers.rb | 2 +- spec/factories/report/customer_traffics.rb | 2 +- spec/factories/report/interval_cdr_schedulers.rb | 2 +- spec/factories/report/interval_cdrs.rb | 2 +- spec/factories/report/interval_data.rb | 2 +- spec/factories/report/realtime/bad_routings.rb | 2 +- spec/factories/report/realtime/not_authenticateds.rb | 2 +- spec/factories/report/scheduler_periods.rb | 2 +- spec/factories/report/vendor_traffic_schedulers.rb | 2 +- spec/factories/report/vendor_traffics.rb | 2 +- spec/factories/routing/area_prefixes.rb | 2 +- spec/factories/routing/areas.rb | 2 +- spec/factories/routing/destination_next_rates.rb | 2 +- spec/factories/routing/destinations.rb | 2 +- spec/factories/routing/numberlist_items.rb | 2 +- spec/factories/routing/numberlists.rb | 2 +- spec/factories/routing/rate_groups.rb | 2 +- spec/factories/routing/rateplans.rb | 2 +- spec/factories/routing/routeset_discriminators.rb | 2 +- spec/factories/routing/routing_groups.rb | 2 +- spec/factories/routing/routing_plan_static_routes.rb | 2 +- spec/factories/routing/routing_plans.rb | 2 +- spec/factories/routing/routing_tag_detection_rules.rb | 2 +- spec/factories/routing/routing_tags.rb | 2 +- spec/factories/routing/tag_actions.rb | 2 +- spec/factories/rtp_statistics/rx_streams.rb | 2 +- spec/factories/rtp_statistics/tx_streams.rb | 2 +- spec/factories/stats/active_call_accounts.rb | 2 +- spec/factories/stats/active_call_orig_gateways.rb | 2 +- spec/factories/stats/active_call_term_gateways.rb | 2 +- spec/factories/stats/active_calls.rb | 2 +- spec/factories/stats/customer_auth_stats.rb | 2 +- spec/factories/stats/termination_quality_stats.rb | 2 +- spec/factories/system/api_log_configs.rb | 2 +- spec/factories/system/cdr_configs.rb | 2 +- spec/factories/system/cdr_price_round_modes.rb | 2 +- spec/factories/system/cdr_round_modes.rb | 2 +- spec/factories/system/countries.rb | 2 +- spec/factories/system/event_subscriptions.rb | 2 +- spec/factories/system/lnp_resolvers.rb | 2 +- spec/factories/system/load_balancers.rb | 2 +- spec/factories/system/lua_scripts.rb | 2 +- spec/factories/system/network_prefixes.rb | 2 +- spec/factories/system/network_types.rb | 2 +- spec/factories/system/networks.rb | 2 +- spec/factories/system/sensors.rb | 2 +- spec/factories/system/smtp_connections.rb | 2 +- spec/factories/system/timezones.rb | 2 +- 127 files changed, 127 insertions(+), 127 deletions(-) diff --git a/spec/factories/account_balance_notification_settings.rb b/spec/factories/account_balance_notification_settings.rb index fd01aa604..479b941ea 100644 --- a/spec/factories/account_balance_notification_settings.rb +++ b/spec/factories/account_balance_notification_settings.rb @@ -20,6 +20,6 @@ # fk_rails_f185d22f87 (account_id => accounts.id) # FactoryBot.define do - factory :account_balance_notification_setting do + factory :account_balance_notification_setting, class: 'AccountBalanceNotificationSetting' do end end diff --git a/spec/factories/accounts.rb b/spec/factories/accounts.rb index c0ca69ed0..9c388d4cc 100644 --- a/spec/factories/accounts.rb +++ b/spec/factories/accounts.rb @@ -39,7 +39,7 @@ # accounts_timezone_id_fkey (timezone_id => timezones.id) # FactoryBot.define do - factory :account, class: Account do + factory :account, class: 'Account' do sequence(:name) { |n| "account#{n}" } association :contractor, vendor: true balance { 0 } diff --git a/spec/factories/active_calls.rb b/spec/factories/active_calls.rb index 42336915c..72cd0b9c6 100644 --- a/spec/factories/active_calls.rb +++ b/spec/factories/active_calls.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :active_call, class: RealtimeData::ActiveCall do + factory :active_call, class: 'RealtimeData::ActiveCall' do trait :filled do duration { (rand(60) + rand).round(7) } start_time { rand(120..179).seconds.ago.to_f } diff --git a/spec/factories/admin_users.rb b/spec/factories/admin_users.rb index 132fe1ca6..e2633256c 100644 --- a/spec/factories/admin_users.rb +++ b/spec/factories/admin_users.rb @@ -32,7 +32,7 @@ # index_admin_users_on_reset_password_token (reset_password_token) UNIQUE # FactoryBot.define do - factory :admin_user do + factory :admin_user, class: 'AdminUser' do sequence(:username) { |n| "admin#{n}" } sequence(:email) { |n| "admin#{n}@example.com" } password { '111111' } diff --git a/spec/factories/api_access.rb b/spec/factories/api_access.rb index 0ca93ca36..b08b37025 100644 --- a/spec/factories/api_access.rb +++ b/spec/factories/api_access.rb @@ -21,7 +21,7 @@ # api_access_customer_id_fkey (customer_id => contractors.id) FactoryBot.define do - factory :api_access, class: System::ApiAccess do + factory :api_access, class: 'System::ApiAccess' do sequence(:login) { |n| "api_access-#{n}" } password { ('a'..'z').to_a.shuffle.join } allowed_ips { ['0.0.0.0', '127.0.0.1'] } diff --git a/spec/factories/audit_log_items.rb b/spec/factories/audit_log_items.rb index 6fdb17c6b..ea3c2bc00 100644 --- a/spec/factories/audit_log_items.rb +++ b/spec/factories/audit_log_items.rb @@ -21,7 +21,7 @@ # FactoryBot.define do - factory :audit_log_item, class: AuditLogItem do + factory :audit_log_item, class: 'AuditLogItem' do item_type { 'Account' } association :item, factory: :account event { 'update' } diff --git a/spec/factories/background_tasks.rb b/spec/factories/background_tasks.rb index 0221b6d77..c97ce0a80 100644 --- a/spec/factories/background_tasks.rb +++ b/spec/factories/background_tasks.rb @@ -24,7 +24,7 @@ # FactoryBot.define do - factory :background_task, class: BackgroundTask do + factory :background_task, class: 'BackgroundTask' do priority { 0 } attempts { 0 } handler { "--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper\njob_data:\n job_class: Worker::CdrExportJob\n job_id: 71b02934-f68e-4a98-a90c-de8d274a37ed\n provider_job_id: \n queue_name: cdr_export\n priority: \n arguments:\n - 1\n executions: 0\n locale: en\n" } diff --git a/spec/factories/billing/contacts.rb b/spec/factories/billing/contacts.rb index 19e627162..3c6cf4982 100644 --- a/spec/factories/billing/contacts.rb +++ b/spec/factories/billing/contacts.rb @@ -22,7 +22,7 @@ # contacts_contractor_id_fkey (contractor_id => contractors.id) # FactoryBot.define do - factory :contact, class: Billing::Contact do + factory :contact, class: 'Billing::Contact' do sequence(:email) { |n| "rspec_mail_#{n}@example.com" } association :contractor, factory: :customer diff --git a/spec/factories/billing/invoice_documents.rb b/spec/factories/billing/invoice_documents.rb index 53c4970c2..98acd83d1 100644 --- a/spec/factories/billing/invoice_documents.rb +++ b/spec/factories/billing/invoice_documents.rb @@ -20,7 +20,7 @@ # FactoryBot.define do - factory :invoice_document, class: Billing::InvoiceDocument do + factory :invoice_document, class: 'Billing::InvoiceDocument' do invoice filename { 'fine.example' } diff --git a/spec/factories/billing/invoice_originated_destinations.rb b/spec/factories/billing/invoice_originated_destinations.rb index c983fc3da..5184f95ab 100644 --- a/spec/factories/billing/invoice_originated_destinations.rb +++ b/spec/factories/billing/invoice_originated_destinations.rb @@ -29,7 +29,7 @@ # FactoryBot.define do - factory :invoice_originated_destination, class: Billing::InvoiceOriginatedDestination do + factory :invoice_originated_destination, class: 'Billing::InvoiceOriginatedDestination' do invoice { FactoryBot.create(:invoice, :manual, account: FactoryBot.create(:account)) } trait :filled do diff --git a/spec/factories/billing/invoice_originated_networks.rb b/spec/factories/billing/invoice_originated_networks.rb index deb7a5605..786e2412d 100644 --- a/spec/factories/billing/invoice_originated_networks.rb +++ b/spec/factories/billing/invoice_originated_networks.rb @@ -28,7 +28,7 @@ # FactoryBot.define do - factory :invoice_originated_network, class: Billing::InvoiceOriginatedNetwork do + factory :invoice_originated_network, class: 'Billing::InvoiceOriginatedNetwork' do invoice { FactoryBot.create(:invoice, :manual, account: FactoryBot.create(:account)) } trait :filled do diff --git a/spec/factories/billing/invoice_service_data.rb b/spec/factories/billing/invoice_service_data.rb index a82733979..2b06ffc77 100644 --- a/spec/factories/billing/invoice_service_data.rb +++ b/spec/factories/billing/invoice_service_data.rb @@ -20,7 +20,7 @@ # invoice_service_data_invoice_id_fkey (invoice_id => invoices.id) # FactoryBot.define do - factory :invoice_service_data, class: Billing::InvoiceServiceData do + factory :invoice_service_data, class: 'Billing::InvoiceServiceData' do invoice { FactoryBot.create(:invoice, :manual, account: FactoryBot.create(:account)) } transactions_count { 1 } amount { 0.01 } diff --git a/spec/factories/billing/invoice_templates.rb b/spec/factories/billing/invoice_templates.rb index 3804668a4..246132391 100644 --- a/spec/factories/billing/invoice_templates.rb +++ b/spec/factories/billing/invoice_templates.rb @@ -16,7 +16,7 @@ # invoices_templates_name_key (name) UNIQUE # FactoryBot.define do - factory :invoice_template, class: Billing::InvoiceTemplate do + factory :invoice_template, class: 'Billing::InvoiceTemplate' do sequence(:name) { |n| "invoice_template#{n}" } filename { 'filename.odt' } end diff --git a/spec/factories/billing/invoice_terminated_destinations.rb b/spec/factories/billing/invoice_terminated_destinations.rb index 7a31e0fa0..3abc3ee4d 100644 --- a/spec/factories/billing/invoice_terminated_destinations.rb +++ b/spec/factories/billing/invoice_terminated_destinations.rb @@ -29,7 +29,7 @@ # FactoryBot.define do - factory :invoice_terminated_destination, class: Billing::InvoiceTerminatedDestination do + factory :invoice_terminated_destination, class: 'Billing::InvoiceTerminatedDestination' do invoice { FactoryBot.create(:invoice, :manual, account: FactoryBot.create(:account)) } trait :filled do diff --git a/spec/factories/billing/invoice_terminated_networks.rb b/spec/factories/billing/invoice_terminated_networks.rb index f0cfbf100..05ea07f19 100644 --- a/spec/factories/billing/invoice_terminated_networks.rb +++ b/spec/factories/billing/invoice_terminated_networks.rb @@ -28,7 +28,7 @@ # FactoryBot.define do - factory :invoice_terminated_network, class: Billing::InvoiceTerminatedNetwork do + factory :invoice_terminated_network, class: 'Billing::InvoiceTerminatedNetwork' do invoice { FactoryBot.create(:invoice, :manual, account: FactoryBot.create(:account)) } trait :filled do diff --git a/spec/factories/billing/invoices.rb b/spec/factories/billing/invoices.rb index 974203570..d7fdd946b 100644 --- a/spec/factories/billing/invoices.rb +++ b/spec/factories/billing/invoices.rb @@ -42,7 +42,7 @@ # index_billing.invoices_on_reference (reference) # FactoryBot.define do - factory :invoice, class: Billing::Invoice do + factory :invoice, class: 'Billing::Invoice' do start_date { 7.days.ago.utc } end_date { 1.day.ago.utc } state_id { Billing::InvoiceState::NEW } diff --git a/spec/factories/billing/package_counters.rb b/spec/factories/billing/package_counters.rb index 24d1dca46..926128947 100644 --- a/spec/factories/billing/package_counters.rb +++ b/spec/factories/billing/package_counters.rb @@ -22,7 +22,7 @@ # package_counters_account_id_fkey (account_id => accounts.id) # FactoryBot.define do - factory :billing_package_counter, class: Billing::PackageCounter do + factory :billing_package_counter, class: 'Billing::PackageCounter' do account { FactoryBot.create(:account) } service { FactoryBot.create(:service) } prefix { '' } diff --git a/spec/factories/billing/service_types.rb b/spec/factories/billing/service_types.rb index b9c187f12..8bd04ab9b 100644 --- a/spec/factories/billing/service_types.rb +++ b/spec/factories/billing/service_types.rb @@ -15,7 +15,7 @@ # service_types_name_key (name) UNIQUE # FactoryBot.define do - factory :service_type, class: Billing::ServiceType do + factory :service_type, class: 'Billing::ServiceType' do sequence(:name) { |n| "Service Type #{n}" } provisioning_class { 'Billing::Provisioning::Logging' } variables { { 'foo' => 'bar' } } diff --git a/spec/factories/billing/services.rb b/spec/factories/billing/services.rb index 198550299..94a40ccd1 100644 --- a/spec/factories/billing/services.rb +++ b/spec/factories/billing/services.rb @@ -30,7 +30,7 @@ # services_type_id_fkey (type_id => service_types.id) # FactoryBot.define do - factory :service, class: Billing::Service do + factory :service, class: 'Billing::Service' do sequence(:name) { |n| "Service_#{n}" } account { FactoryBot.create(:account) } type { FactoryBot.create(:service_type) } diff --git a/spec/factories/billing/transactions.rb b/spec/factories/billing/transactions.rb index 7e33a3855..bc3d1f340 100644 --- a/spec/factories/billing/transactions.rb +++ b/spec/factories/billing/transactions.rb @@ -23,7 +23,7 @@ # transactions_account_id_fkey (account_id => accounts.id) # FactoryBot.define do - factory :billing_transaction, class: Billing::Transaction do + factory :billing_transaction, class: 'Billing::Transaction' do transient do spent { true } end diff --git a/spec/factories/cdr/auth_logs.rb b/spec/factories/cdr/auth_logs.rb index 8bd8d653d..d8e32ca1b 100644 --- a/spec/factories/cdr/auth_logs.rb +++ b/spec/factories/cdr/auth_logs.rb @@ -44,7 +44,7 @@ # auth_log_request_time_idx (request_time) # FactoryBot.define do - factory :auth_log, class: Cdr::AuthLog do + factory :auth_log, class: 'Cdr::AuthLog' do request_time { 1.minute.ago } code { 200 } reason { 'OK' } diff --git a/spec/factories/cdr/cdrs.rb b/spec/factories/cdr/cdrs.rb index f6c11760e..95b81622c 100644 --- a/spec/factories/cdr/cdrs.rb +++ b/spec/factories/cdr/cdrs.rb @@ -157,7 +157,7 @@ # cdr_vendor_id_time_start_idx (vendor_id,time_start) # FactoryBot.define do - factory :cdr, class: Cdr::Cdr do + factory :cdr, class: 'Cdr::Cdr' do uuid { SecureRandom.uuid } is_last_cdr { true } time_start { 1.minute.ago } diff --git a/spec/factories/cdr_exports.rb b/spec/factories/cdr_exports.rb index d71071c66..f582e3317 100644 --- a/spec/factories/cdr_exports.rb +++ b/spec/factories/cdr_exports.rb @@ -26,7 +26,7 @@ # fk_rails_e796f29195 (customer_account_id => accounts.id) # FactoryBot.define do - factory :cdr_export, class: CdrExport do + factory :cdr_export, class: 'CdrExport' do type { 'Base' } callback_url { nil } filters do diff --git a/spec/factories/cnam/database_https.rb b/spec/factories/cnam/database_https.rb index a068e7035..c20419d82 100644 --- a/spec/factories/cnam/database_https.rb +++ b/spec/factories/cnam/database_https.rb @@ -9,7 +9,7 @@ # url :string not null # FactoryBot.define do - factory :cnam_database_http, class: Cnam::DatabaseHttp do + factory :cnam_database_http, class: 'Cnam::DatabaseHttp' do url { 'https://example.com/{pai}' } timeout { 15_000 } end diff --git a/spec/factories/cnam/databases.rb b/spec/factories/cnam/databases.rb index 208c859ed..135fba241 100644 --- a/spec/factories/cnam/databases.rb +++ b/spec/factories/cnam/databases.rb @@ -18,7 +18,7 @@ # cnam_databases_name_key (name) UNIQUE # FactoryBot.define do - factory :cnam_database, class: Cnam::Database do + factory :cnam_database, class: 'Cnam::Database' do sequence(:name) { |n| "CNAM db script_#{n}" } request_lua { 'arg.a="000"; table.insert(arg.v,9); return arg;' } response_lua { 'arg.a="000"; table.insert(arg.v,9); return arg;' } diff --git a/spec/factories/codec_group_codec.rb b/spec/factories/codec_group_codec.rb index e3a22d3cf..3578865af 100644 --- a/spec/factories/codec_group_codec.rb +++ b/spec/factories/codec_group_codec.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :codec_group_codec do + factory :codec_group_codec, class: 'CodecGroupCodec' do sequence(:priority, 10) dynamic_payload_type { 100 } end diff --git a/spec/factories/codec_groups.rb b/spec/factories/codec_groups.rb index d6d74257a..5cba22647 100644 --- a/spec/factories/codec_groups.rb +++ b/spec/factories/codec_groups.rb @@ -12,7 +12,7 @@ # codec_groups_name_key (name) UNIQUE # FactoryBot.define do - factory :codec_group do + factory :codec_group, class: 'CodecGroup' do sequence(:name) { |n| "codec_group#{n}" } codec_group_codecs do [ diff --git a/spec/factories/contractors.rb b/spec/factories/contractors.rb index 2c5bae6fc..7d9c4e771 100644 --- a/spec/factories/contractors.rb +++ b/spec/factories/contractors.rb @@ -25,7 +25,7 @@ # contractors_smtp_connection_id_fkey (smtp_connection_id => smtp_connections.id) # FactoryBot.define do - factory :contractor, class: Contractor do + factory :contractor, class: 'Contractor' do sequence(:name) { |n| "contractor#{n}" } enabled { true } vendor { false } diff --git a/spec/factories/cron_job_infos.rb b/spec/factories/cron_job_infos.rb index 920e54b88..e934be709 100644 --- a/spec/factories/cron_job_infos.rb +++ b/spec/factories/cron_job_infos.rb @@ -11,7 +11,7 @@ # name :string not null # FactoryBot.define do - factory :cron_job_info, class: CronJobInfo do + factory :cron_job_info, class: 'CronJobInfo' do name { nil } # required trait :active do diff --git a/spec/factories/customers_auths.rb b/spec/factories/customers_auths.rb index 0193316b9..d0e03fbef 100644 --- a/spec/factories/customers_auths.rb +++ b/spec/factories/customers_auths.rb @@ -104,7 +104,7 @@ # customers_auth_transport_protocol_id_fkey (transport_protocol_id => transport_protocols.id) # FactoryBot.define do - factory :customers_auth, class: CustomersAuth do + factory :customers_auth, class: 'CustomersAuth' do sequence(:name) { |n| "customers_auth_#{n}" } diversion_policy_id { 1 } dump_level_id { 1 } diff --git a/spec/factories/dialpeer_next_rates.rb b/spec/factories/dialpeer_next_rates.rb index 93dbee2a0..7271b718e 100644 --- a/spec/factories/dialpeer_next_rates.rb +++ b/spec/factories/dialpeer_next_rates.rb @@ -26,7 +26,7 @@ # dialpeer_next_rates_dialpeer_id_fkey (dialpeer_id => dialpeers.id) # FactoryBot.define do - factory :dialpeer_next_rate do + factory :dialpeer_next_rate, class: 'DialpeerNextRate' do initial_rate { 0 } next_rate { 0 } initial_interval { 5 } diff --git a/spec/factories/dialpeers.rb b/spec/factories/dialpeers.rb index 91b642046..660de52f8 100644 --- a/spec/factories/dialpeers.rb +++ b/spec/factories/dialpeers.rb @@ -65,7 +65,7 @@ # dialpeers_vendor_id_fkey (vendor_id => contractors.id) # FactoryBot.define do - factory :dialpeer, class: Dialpeer do + factory :dialpeer, class: 'Dialpeer' do sequence(:external_id) enabled { true } reverse_billing { false } diff --git a/spec/factories/disconnect_codes.rb b/spec/factories/disconnect_codes.rb index 27167e742..198d282dc 100644 --- a/spec/factories/disconnect_codes.rb +++ b/spec/factories/disconnect_codes.rb @@ -27,7 +27,7 @@ # FactoryBot.define do - factory :disconnect_code, class: DisconnectCode do + factory :disconnect_code, class: 'DisconnectCode' do id { (DisconnectCode.pick(Arel.sql('MAX(id)')) || 0) + 1 } # broken sequence in class4.sql sequence(:code, 100) { |n| n } sequence(:reason, 100) { |n| "reason_#{n}" } diff --git a/spec/factories/disconnect_policy.rb b/spec/factories/disconnect_policy.rb index 49064a33c..4466c0d7c 100644 --- a/spec/factories/disconnect_policy.rb +++ b/spec/factories/disconnect_policy.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :disconnect_policy, class: DisconnectPolicy do + factory :disconnect_policy, class: 'DisconnectPolicy' do sequence(:name) { |n| "disconnect_policy#{n}" } trait :filled do diff --git a/spec/factories/disconnect_policy_code.rb b/spec/factories/disconnect_policy_code.rb index 794174171..37e8de444 100644 --- a/spec/factories/disconnect_policy_code.rb +++ b/spec/factories/disconnect_policy_code.rb @@ -19,7 +19,7 @@ # FactoryBot.define do - factory :disconnect_policy_code, class: DisconnectPolicyCode do + factory :disconnect_policy_code, class: 'DisconnectPolicyCode' do policy { DisconnectPolicy.take || create(:disconnect_policy) } code { DisconnectCode.take! } end diff --git a/spec/factories/equipment/radius/accounting_profile_start_attributes.rb b/spec/factories/equipment/radius/accounting_profile_start_attributes.rb index fbb856f4b..ec66afa39 100644 --- a/spec/factories/equipment/radius/accounting_profile_start_attributes.rb +++ b/spec/factories/equipment/radius/accounting_profile_start_attributes.rb @@ -20,7 +20,7 @@ # FactoryBot.define do - factory :accounting_profile_start_attribute, class: Equipment::Radius::AccountingProfileStartAttribute do + factory :accounting_profile_start_attribute, class: 'Equipment::Radius::AccountingProfileStartAttribute' do association :profile, factory: :accounting_profile type_id { 1 } sequence(:name) { |n| "accounting_profile_start_#{n}" } diff --git a/spec/factories/equipment/radius/accounting_profile_stop_attributes.rb b/spec/factories/equipment/radius/accounting_profile_stop_attributes.rb index a4c99d675..19398961d 100644 --- a/spec/factories/equipment/radius/accounting_profile_stop_attributes.rb +++ b/spec/factories/equipment/radius/accounting_profile_stop_attributes.rb @@ -20,7 +20,7 @@ # FactoryBot.define do - factory :accounting_profile_stop_attribute, class: Equipment::Radius::AccountingProfileStopAttribute do + factory :accounting_profile_stop_attribute, class: 'Equipment::Radius::AccountingProfileStopAttribute' do association :profile, factory: :accounting_profile type_id { 1 } sequence(:name) { |n| "accounting_profile_stop_#{n}" } diff --git a/spec/factories/equipment/radius/accounting_profiles.rb b/spec/factories/equipment/radius/accounting_profiles.rb index d3c790eff..4e967bf3e 100644 --- a/spec/factories/equipment/radius/accounting_profiles.rb +++ b/spec/factories/equipment/radius/accounting_profiles.rb @@ -21,7 +21,7 @@ # radius_accounting_profiles_name_key (name) UNIQUE # FactoryBot.define do - factory :accounting_profile, class: Equipment::Radius::AccountingProfile do + factory :accounting_profile, class: 'Equipment::Radius::AccountingProfile' do sequence(:name) { |n| "profile#{n}" } server { 'server' } port { '1' } diff --git a/spec/factories/equipment/radius/auth_profiles.rb b/spec/factories/equipment/radius/auth_profiles.rb index 7cd55f00e..b7c59f435 100644 --- a/spec/factories/equipment/radius/auth_profiles.rb +++ b/spec/factories/equipment/radius/auth_profiles.rb @@ -18,7 +18,7 @@ # radius_auth_profiles_name_key (name) UNIQUE # FactoryBot.define do - factory :auth_profile, class: Equipment::Radius::AuthProfile do + factory :auth_profile, class: 'Equipment::Radius::AuthProfile' do sequence(:name) { |n| "auth_profile#{n}" } server { 'server' } port { '1' } diff --git a/spec/factories/equipment/registrations.rb b/spec/factories/equipment/registrations.rb index b2d465fe4..05ff909be 100644 --- a/spec/factories/equipment/registrations.rb +++ b/spec/factories/equipment/registrations.rb @@ -37,7 +37,7 @@ # registrations_transport_protocol_id_fkey (transport_protocol_id => transport_protocols.id) # FactoryBot.define do - factory :registration, class: Equipment::Registration do + factory :registration, class: 'Equipment::Registration' do sequence(:name) { |n| "Equipment Registration #{n}" } domain { 'localhost' } username { 'user name' } diff --git a/spec/factories/equipment/sip_options_probers.rb b/spec/factories/equipment/sip_options_probers.rb index 7941a00e8..d1eee4909 100644 --- a/spec/factories/equipment/sip_options_probers.rb +++ b/spec/factories/equipment/sip_options_probers.rb @@ -40,7 +40,7 @@ # sip_options_probers_transport_protocol_id_fkey (transport_protocol_id => transport_protocols.id) # FactoryBot.define do - factory :sip_options_prober, class: Equipment::SipOptionsProber do + factory :sip_options_prober, class: 'Equipment::SipOptionsProber' do sequence(:name) { |n| "SIP Options Prober #{n}" } sequence(:ruri_domain) { |n| "#{n}.sip.com" } sequence(:ruri_username) { |n| "username_#{n}" } diff --git a/spec/factories/equipment/stir_shaken/signing_certificates.rb b/spec/factories/equipment/stir_shaken/signing_certificates.rb index b31c256e1..6fcbc39c1 100644 --- a/spec/factories/equipment/stir_shaken/signing_certificates.rb +++ b/spec/factories/equipment/stir_shaken/signing_certificates.rb @@ -12,7 +12,7 @@ # updated_at :timestamptz # FactoryBot.define do - factory :stir_shaken_signing_certificate, class: Equipment::StirShaken::SigningCertificate do + factory :stir_shaken_signing_certificate, class: 'Equipment::StirShaken::SigningCertificate' do sequence(:name) { |n| "test_#{n}" } sequence(:certificate) { |n| "----BEGIN CERTIFICATE----\n test_#{n}\n----END CERTIFICATE----" } sequence(:key) { |n| "----BEGIN PRIVATE KEY----\n test_#{n}\n----END PRIVATE KEY----" } diff --git a/spec/factories/equipment/stir_shaken/trusted_certificates.rb b/spec/factories/equipment/stir_shaken/trusted_certificates.rb index 5c6131e8a..3653291ec 100644 --- a/spec/factories/equipment/stir_shaken/trusted_certificates.rb +++ b/spec/factories/equipment/stir_shaken/trusted_certificates.rb @@ -10,7 +10,7 @@ # updated_at :timestamptz # FactoryBot.define do - factory :stir_shaken_trusted_certificate, class: Equipment::StirShaken::TrustedCertificate do + factory :stir_shaken_trusted_certificate, class: 'Equipment::StirShaken::TrustedCertificate' do sequence(:name) { |n| "test_#{n}" } sequence(:certificate) { |n| "----BEGIN CERTIFICATE----\n test_#{n}\n----END CERTIFICATE----" } updated_at { Time.now.utc.change(usec: 0) } diff --git a/spec/factories/equipment/stir_shaken/trusted_repositories.rb b/spec/factories/equipment/stir_shaken/trusted_repositories.rb index 4ac957b00..09b98bfff 100644 --- a/spec/factories/equipment/stir_shaken/trusted_repositories.rb +++ b/spec/factories/equipment/stir_shaken/trusted_repositories.rb @@ -10,7 +10,7 @@ # updated_at :timestamptz # FactoryBot.define do - factory :stir_shaken_trusted_repository, class: Equipment::StirShaken::TrustedRepository do + factory :stir_shaken_trusted_repository, class: 'Equipment::StirShaken::TrustedRepository' do sequence(:url_pattern) { |n| "https://test_#{n}" } validate_https_certificate { true } updated_at { Time.now.utc.change(usec: 0) } diff --git a/spec/factories/events.rb b/spec/factories/events.rb index 71973e483..a39bdce3b 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -18,7 +18,7 @@ # FactoryBot.define do - factory :event, class: Event do + factory :event, class: 'Event' do command { 'reload_registrations' } retries { 5 } node diff --git a/spec/factories/gateway_groups.rb b/spec/factories/gateway_groups.rb index 46d537d6b..6a16cb382 100644 --- a/spec/factories/gateway_groups.rb +++ b/spec/factories/gateway_groups.rb @@ -21,7 +21,7 @@ # gateway_groups_contractor_id_fkey (vendor_id => contractors.id) # FactoryBot.define do - factory :gateway_group, class: GatewayGroup do + factory :gateway_group, class: 'GatewayGroup' do sequence(:name) { |n| "gateway_group_#{n}" } balancing_mode_id { 2 } association :vendor, factory: :contractor, vendor: true diff --git a/spec/factories/gateways.rb b/spec/factories/gateways.rb index 521badd43..2a51ed6b0 100644 --- a/spec/factories/gateways.rb +++ b/spec/factories/gateways.rb @@ -166,7 +166,7 @@ # gateways_tx_inband_dtmf_filtering_mode_id_fkey (tx_inband_dtmf_filtering_mode_id => gateway_inband_dtmf_filtering_modes.id) # FactoryBot.define do - factory :gateway, class: Gateway do + factory :gateway, class: 'Gateway' do sequence(:name) { |n| "gateway#{n}" } enabled { true } priority { 122 } diff --git a/spec/factories/gateways_stats.rb b/spec/factories/gateways_stats.rb index b1a76cf83..4765a1a9b 100644 --- a/spec/factories/gateways_stats.rb +++ b/spec/factories/gateways_stats.rb @@ -22,7 +22,7 @@ # unique_gw (gateway_id) UNIQUE # FactoryBot.define do - factory :gateways_stat, class: GatewaysStat do + factory :gateways_stat, class: 'GatewaysStat' do gateway created_at { Time.now.utc } updated_at { 1.hour.ago.utc } diff --git a/spec/factories/importing/accounts.rb b/spec/factories/importing/accounts.rb index cbbc9ee3f..40b55f1f7 100644 --- a/spec/factories/importing/accounts.rb +++ b/spec/factories/importing/accounts.rb @@ -26,7 +26,7 @@ # o_id :integer(4) # FactoryBot.define do - factory :importing_account, class: Importing::Account do + factory :importing_account, class: 'Importing::Account' do o_id { nil } name { nil } contractor_name { nil } diff --git a/spec/factories/importing/contractors.rb b/spec/factories/importing/contractors.rb index 0a4327c62..fc7ce2978 100644 --- a/spec/factories/importing/contractors.rb +++ b/spec/factories/importing/contractors.rb @@ -19,7 +19,7 @@ # smtp_connection_id :integer(4) # FactoryBot.define do - factory :importing_contractor, class: Importing::Contractor do + factory :importing_contractor, class: 'Importing::Contractor' do o_id { nil } error_string { nil } diff --git a/spec/factories/importing/customers_auths.rb b/spec/factories/importing/customers_auths.rb index e1cb8e130..43630f382 100644 --- a/spec/factories/importing/customers_auths.rb +++ b/spec/factories/importing/customers_auths.rb @@ -85,7 +85,7 @@ # transport_protocol_id :integer(2) # FactoryBot.define do - factory :importing_customers_auth, class: Importing::CustomersAuth do + factory :importing_customers_auth, class: 'Importing::CustomersAuth' do transient do _tag_action { Routing::TagAction.last } _routing_tags { create_list(:routing_tag, 2) } diff --git a/spec/factories/importing/destinations.rb b/spec/factories/importing/destinations.rb index 7da9b496e..47f582b3b 100644 --- a/spec/factories/importing/destinations.rb +++ b/spec/factories/importing/destinations.rb @@ -40,7 +40,7 @@ # routing_tag_mode_id :integer(2) # FactoryBot.define do - factory :importing_destination, class: Importing::Destination do + factory :importing_destination, class: 'Importing::Destination' do transient do _tags { create_list(:routing_tag, 2) } end diff --git a/spec/factories/importing/dialpeers.rb b/spec/factories/importing/dialpeers.rb index 0808d1120..98f1020d1 100644 --- a/spec/factories/importing/dialpeers.rb +++ b/spec/factories/importing/dialpeers.rb @@ -53,7 +53,7 @@ # vendor_id :integer(4) # FactoryBot.define do - factory :importing_dialpeer, class: Importing::Dialpeer do + factory :importing_dialpeer, class: 'Importing::Dialpeer' do transient do _tags { create_list(:routing_tag, 2) } end diff --git a/spec/factories/importing/disconnect_policies.rb b/spec/factories/importing/disconnect_policies.rb index a20502dfe..bd6c6a987 100644 --- a/spec/factories/importing/disconnect_policies.rb +++ b/spec/factories/importing/disconnect_policies.rb @@ -11,7 +11,7 @@ # o_id :integer(4) # FactoryBot.define do - factory :importing_disconnect_policy, class: Importing::DisconnectPolicy do + factory :importing_disconnect_policy, class: 'Importing::DisconnectPolicy' do o_id { nil } name { nil } error_string { nil } diff --git a/spec/factories/importing/gateway_groups.rb b/spec/factories/importing/gateway_groups.rb index db14c3c08..e62b6d659 100644 --- a/spec/factories/importing/gateway_groups.rb +++ b/spec/factories/importing/gateway_groups.rb @@ -16,7 +16,7 @@ # vendor_id :integer(4) # FactoryBot.define do - factory :importing_gateway_group, class: Importing::GatewayGroup do + factory :importing_gateway_group, class: 'Importing::GatewayGroup' do o_id { nil } name { nil } vendor_name { nil } diff --git a/spec/factories/importing/gateways.rb b/spec/factories/importing/gateways.rb index bc5a59704..c203f2614 100644 --- a/spec/factories/importing/gateways.rb +++ b/spec/factories/importing/gateways.rb @@ -146,7 +146,7 @@ # tx_inband_dtmf_filtering_mode_id :integer(2) # FactoryBot.define do - factory :importing_gateway, class: Importing::Gateway do + factory :importing_gateway, class: 'Importing::Gateway' do o_id { nil } host { nil } port { nil } diff --git a/spec/factories/importing/numberlist_items.rb b/spec/factories/importing/numberlist_items.rb index 543852764..26bf85ad4 100644 --- a/spec/factories/importing/numberlist_items.rb +++ b/spec/factories/importing/numberlist_items.rb @@ -27,7 +27,7 @@ # tag_action_id :integer(4) # FactoryBot.define do - factory :importing_numberlist_item, class: Importing::NumberlistItem do + factory :importing_numberlist_item, class: 'Importing::NumberlistItem' do transient do _numberlist { Routing::Numberlist.take || create(:numberlist) } _action_id { Routing::NumberlistItem::ACTION_REJECT } diff --git a/spec/factories/importing/numberlists.rb b/spec/factories/importing/numberlists.rb index bbb0d53b1..fbc664c42 100644 --- a/spec/factories/importing/numberlists.rb +++ b/spec/factories/importing/numberlists.rb @@ -25,7 +25,7 @@ # tag_action_id :integer(4) # FactoryBot.define do - factory :importing_numberlist, class: Importing::Numberlist do + factory :importing_numberlist, class: 'Importing::Numberlist' do transient do _mode_id { Routing::Numberlist::MODE_STRICT } _mode_name { Routing::Numberlist::MODES[Routing::Numberlist::MODE_STRICT] } diff --git a/spec/factories/importing/rateplans.rb b/spec/factories/importing/rateplans.rb index a2a9724d8..53c91bec0 100644 --- a/spec/factories/importing/rateplans.rb +++ b/spec/factories/importing/rateplans.rb @@ -13,7 +13,7 @@ # profit_control_mode_id :integer(4) # FactoryBot.define do - factory :importing_rateplan, class: Importing::Rateplan do + factory :importing_rateplan, class: 'Importing::Rateplan' do o_id { nil } error_string { nil } diff --git a/spec/factories/importing/registrations.rb b/spec/factories/importing/registrations.rb index 48600b421..8f30232dd 100644 --- a/spec/factories/importing/registrations.rb +++ b/spec/factories/importing/registrations.rb @@ -33,7 +33,7 @@ # transport_protocol_id :integer(2) # FactoryBot.define do - factory :importing_registration, class: Importing::Registration do + factory :importing_registration, class: 'Importing::Registration' do o_id { nil } name { nil } enabled { true } diff --git a/spec/factories/importing/routing_groups.rb b/spec/factories/importing/routing_groups.rb index a97507b88..ee1319d99 100644 --- a/spec/factories/importing/routing_groups.rb +++ b/spec/factories/importing/routing_groups.rb @@ -11,7 +11,7 @@ # o_id :integer(4) # FactoryBot.define do - factory :importing_routing_group, class: Importing::RoutingGroup do + factory :importing_routing_group, class: 'Importing::RoutingGroup' do o_id { nil } name { nil } error_string { nil } diff --git a/spec/factories/importing/routing_tag_detection_rules.rb b/spec/factories/importing/routing_tag_detection_rules.rb index 5dd27f05c..61febb4b9 100644 --- a/spec/factories/importing/routing_tag_detection_rules.rb +++ b/spec/factories/importing/routing_tag_detection_rules.rb @@ -34,7 +34,7 @@ # fk_rails_db4b62868c (src_area_id => areas.id) # FactoryBot.define do - factory :importing_routing_tag_detection_rule, class: Importing::RoutingTagDetectionRule do + factory :importing_routing_tag_detection_rule, class: 'Importing::RoutingTagDetectionRule' do transient do _routing_tags { create_list(:routing_tag, 2) } _tag_action { Routing::TagAction.take } diff --git a/spec/factories/incoming_registrations.rb b/spec/factories/incoming_registrations.rb index 9182947d4..e4dae4f1e 100644 --- a/spec/factories/incoming_registrations.rb +++ b/spec/factories/incoming_registrations.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :incoming_registration, class: RealtimeData::IncomingRegistration do + factory :incoming_registration, class: 'RealtimeData::IncomingRegistration' do trait :filled do auth_id { 123 } contact { 'sip:test@10.255.10.2' } diff --git a/spec/factories/lnp/caches.rb b/spec/factories/lnp/caches.rb index 374deb21b..d2656b3ed 100644 --- a/spec/factories/lnp/caches.rb +++ b/spec/factories/lnp/caches.rb @@ -25,7 +25,7 @@ # FactoryBot.define do - factory :lnp_cache, class: Lnp::Cache do + factory :lnp_cache, class: 'Lnp::Cache' do sequence(:dst) { |n| "dst#{n}" } lrn { 'lrn' } expires_at { Time.now.utc + 200_000 } diff --git a/spec/factories/lnp/databases.rb b/spec/factories/lnp/databases.rb index 913445816..b74770af3 100644 --- a/spec/factories/lnp/databases.rb +++ b/spec/factories/lnp/databases.rb @@ -18,7 +18,7 @@ # FactoryBot.define do - factory :lnp_database, class: Lnp::Database do + factory :lnp_database, class: 'Lnp::Database' do sequence(:name) { |n| "LNP Database #{n}" } cache_ttl { 120 } diff --git a/spec/factories/lnp/routing_plan_lnp_rules.rb b/spec/factories/lnp/routing_plan_lnp_rules.rb index 99602f8aa..e9b7d420f 100644 --- a/spec/factories/lnp/routing_plan_lnp_rules.rb +++ b/spec/factories/lnp/routing_plan_lnp_rules.rb @@ -29,7 +29,7 @@ # FactoryBot.define do - factory :lnp_routing_plan_lnp_rule, class: Lnp::RoutingPlanLnpRule do + factory :lnp_routing_plan_lnp_rule, class: 'Lnp::RoutingPlanLnpRule' do association :routing_plan, factory: :routing_plan database { create(:lnp_database, :thinq) } end diff --git a/spec/factories/log/api_logs.rb b/spec/factories/log/api_logs.rb index 52f5d7d72..4ff5c9b9d 100644 --- a/spec/factories/log/api_logs.rb +++ b/spec/factories/log/api_logs.rb @@ -29,7 +29,7 @@ # FactoryBot.define do - factory :api_log, class: Log::ApiLog do + factory :api_log, class: 'Log::ApiLog' do path { '/api/rest/qweasd' } add_attribute(:method) { 'GET' } status { 204 } diff --git a/spec/factories/log/balance_notifications.rb b/spec/factories/log/balance_notifications.rb index f9c23b9d5..482028a17 100644 --- a/spec/factories/log/balance_notifications.rb +++ b/spec/factories/log/balance_notifications.rb @@ -18,7 +18,7 @@ # FactoryBot.define do - factory :balance_notification, class: Log::BalanceNotification do + factory :balance_notification, class: 'Log::BalanceNotification' do created_at { Time.now.utc } event_id { Log::BalanceNotification::CONST::EVENT_ID_HIGH_THRESHOLD_CLEARED } diff --git a/spec/factories/log/email_logs.rb b/spec/factories/log/email_logs.rb index 169a7e25a..07c5ee9db 100644 --- a/spec/factories/log/email_logs.rb +++ b/spec/factories/log/email_logs.rb @@ -19,7 +19,7 @@ # FactoryBot.define do - factory :email_log, class: Log::EmailLog do + factory :email_log, class: 'Log::EmailLog' do sent_at { Time.now.utc } contact smtp_connection diff --git a/spec/factories/logic_logs.rb b/spec/factories/logic_logs.rb index b30c54192..a848465ee 100644 --- a/spec/factories/logic_logs.rb +++ b/spec/factories/logic_logs.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :logic_log, class: LogicLog do + factory :logic_log, class: 'LogicLog' do source { 'Dialpeer (3)' } level { 0 } msg { 'finished' } diff --git a/spec/factories/nodes.rb b/spec/factories/nodes.rb index ff80b2527..84d382d40 100644 --- a/spec/factories/nodes.rb +++ b/spec/factories/nodes.rb @@ -19,7 +19,7 @@ # node_pop_id_fkey (pop_id => pops.id) # FactoryBot.define do - factory :node, class: Node do + factory :node, class: 'Node' do sequence(:id) { |n| n } sequence(:name) { |n| "Node #{n}" } sequence(:rpc_endpoint) { |n| "127.0.0.1:#{1 + n}" } diff --git a/spec/factories/notification/attachments.rb b/spec/factories/notification/attachments.rb index 32866e599..007a4626a 100644 --- a/spec/factories/notification/attachments.rb +++ b/spec/factories/notification/attachments.rb @@ -10,7 +10,7 @@ # FactoryBot.define do - factory :notification_attachment, class: Notification::Attachment do + factory :notification_attachment, class: 'Notification::Attachment' do sequence(:filename) { |n| "some_file#{n}.txt" } sequence(:data) { |n| "some data #{n}" } end diff --git a/spec/factories/outgoing_registrations.rb b/spec/factories/outgoing_registrations.rb index 301262c63..03a9c2096 100644 --- a/spec/factories/outgoing_registrations.rb +++ b/spec/factories/outgoing_registrations.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :outgoing_registration, class: RealtimeData::OutgoingRegistration do + factory :outgoing_registration, class: 'RealtimeData::OutgoingRegistration' do trait :filled do sequence(:id, 1_000) domain { 'qwe.asd.com' } diff --git a/spec/factories/payments.rb b/spec/factories/payments.rb index 71870434b..39999c51a 100644 --- a/spec/factories/payments.rb +++ b/spec/factories/payments.rb @@ -24,7 +24,7 @@ # payments_account_id_fkey (account_id => accounts.id) # FactoryBot.define do - factory :payment, class: Payment do + factory :payment, class: 'Payment' do amount { 10 } association :account notes { 'notes text' } diff --git a/spec/factories/pops.rb b/spec/factories/pops.rb index 80b696175..b486ab6e3 100644 --- a/spec/factories/pops.rb +++ b/spec/factories/pops.rb @@ -12,7 +12,7 @@ # pop_name_key (name) UNIQUE # FactoryBot.define do - factory :pop, class: Pop do + factory :pop, class: 'Pop' do sequence(:id) { |n| n } sequence(:name) { |n| "Point of presence #{n}" } diff --git a/spec/factories/realtime_sip_options_probers.rb b/spec/factories/realtime_sip_options_probers.rb index 6e97d46c1..82d027e93 100644 --- a/spec/factories/realtime_sip_options_probers.rb +++ b/spec/factories/realtime_sip_options_probers.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :realtime_sip_options_prober, class: RealtimeData::SipOptionsProber do + factory :realtime_sip_options_prober, class: 'RealtimeData::SipOptionsProber' do trait :filled do sequence(:id) { |n| n } sequence(:node_id) { |n| n } diff --git a/spec/factories/report/custom_cdr_schedulers.rb b/spec/factories/report/custom_cdr_schedulers.rb index 563fb147b..38d1cab27 100644 --- a/spec/factories/report/custom_cdr_schedulers.rb +++ b/spec/factories/report/custom_cdr_schedulers.rb @@ -20,7 +20,7 @@ # FactoryBot.define do - factory :custom_cdr_scheduler, class: Report::CustomCdrScheduler do + factory :custom_cdr_scheduler, class: 'Report::CustomCdrScheduler' do period { Report::SchedulerPeriod.take || build(:period_scheduler) } group_by { %w[customer_id rateplan_id] } diff --git a/spec/factories/report/custom_cdrs.rb b/spec/factories/report/custom_cdrs.rb index f27e7dc6b..8f60d5566 100644 --- a/spec/factories/report/custom_cdrs.rb +++ b/spec/factories/report/custom_cdrs.rb @@ -16,7 +16,7 @@ # FactoryBot.define do - factory :custom_cdr, class: Report::CustomCdr do + factory :custom_cdr, class: 'Report::CustomCdr' do date_start { Time.now.utc } date_end { Time.now.utc + 1.week } group_by { %w[customer_id rateplan_id] } diff --git a/spec/factories/report/custom_data.rb b/spec/factories/report/custom_data.rb index a86a33185..d3ab48b19 100644 --- a/spec/factories/report/custom_data.rb +++ b/spec/factories/report/custom_data.rb @@ -98,7 +98,7 @@ # cdr_custom_report_data_report_id_fkey (report_id => cdr_custom_report.id) # FactoryBot.define do - factory :custom_data, class: Report::CustomData do + factory :custom_data, class: 'Report::CustomData' do report { association :interval_cdr } end end diff --git a/spec/factories/report/customer_traffic_schedulers.rb b/spec/factories/report/customer_traffic_schedulers.rb index 9c5495385..5d9d838d1 100644 --- a/spec/factories/report/customer_traffic_schedulers.rb +++ b/spec/factories/report/customer_traffic_schedulers.rb @@ -18,7 +18,7 @@ # FactoryBot.define do - factory :customer_traffic_scheduler, class: Report::CustomerTrafficScheduler do + factory :customer_traffic_scheduler, class: 'Report::CustomerTrafficScheduler' do period { Report::SchedulerPeriod.take || build(:period_scheduler) } association :customer end diff --git a/spec/factories/report/customer_traffics.rb b/spec/factories/report/customer_traffics.rb index 434d897ad..3133c6a7a 100644 --- a/spec/factories/report/customer_traffics.rb +++ b/spec/factories/report/customer_traffics.rb @@ -14,7 +14,7 @@ # FactoryBot.define do - factory :customer_traffic, class: Report::CustomerTraffic do + factory :customer_traffic, class: 'Report::CustomerTraffic' do date_start { Time.now.utc } date_end { Time.now.utc + 1.week } diff --git a/spec/factories/report/interval_cdr_schedulers.rb b/spec/factories/report/interval_cdr_schedulers.rb index 6a8af1eba..8ed365924 100644 --- a/spec/factories/report/interval_cdr_schedulers.rb +++ b/spec/factories/report/interval_cdr_schedulers.rb @@ -22,7 +22,7 @@ # FactoryBot.define do - factory :interval_cdr_scheduler, class: Report::IntervalCdrScheduler do + factory :interval_cdr_scheduler, class: 'Report::IntervalCdrScheduler' do period { Report::SchedulerPeriod.take || build(:period_scheduler) } group_by { %w[customer_acc_id] } interval_length { 5 } diff --git a/spec/factories/report/interval_cdrs.rb b/spec/factories/report/interval_cdrs.rb index 91aef425c..2a415c209 100644 --- a/spec/factories/report/interval_cdrs.rb +++ b/spec/factories/report/interval_cdrs.rb @@ -22,7 +22,7 @@ # FactoryBot.define do - factory :interval_cdr, class: Report::IntervalCdr do + factory :interval_cdr, class: 'Report::IntervalCdr' do date_start { Time.now.utc } date_end { Time.now.utc + 1.week } interval_length { 10 } diff --git a/spec/factories/report/interval_data.rb b/spec/factories/report/interval_data.rb index ba2fe88a1..055f18dc0 100644 --- a/spec/factories/report/interval_data.rb +++ b/spec/factories/report/interval_data.rb @@ -88,7 +88,7 @@ # cdr_interval_report_data_report_id_fkey (report_id => cdr_interval_report.id) # FactoryBot.define do - factory :interval_data, class: Report::IntervalData do + factory :interval_data, class: 'Report::IntervalData' do report { association :interval_cdr } disconnect_initiator_id { 1 } end diff --git a/spec/factories/report/realtime/bad_routings.rb b/spec/factories/report/realtime/bad_routings.rb index fba603147..8ea380285 100644 --- a/spec/factories/report/realtime/bad_routings.rb +++ b/spec/factories/report/realtime/bad_routings.rb @@ -157,7 +157,7 @@ # cdr_vendor_id_time_start_idx (vendor_id,time_start) # FactoryBot.define do - factory :bad_routing, class: Report::Realtime::BadRouting, parent: :cdr do + factory :bad_routing, class: 'Report::Realtime::BadRouting', parent: :cdr do time_start { 110.seconds.ago } # this record will be available in page during 10 second disconnect_initiator_id { Cdr::Cdr::DISCONNECT_INITIATOR_ROUTING } association :customer_auth, factory: :customers_auth diff --git a/spec/factories/report/realtime/not_authenticateds.rb b/spec/factories/report/realtime/not_authenticateds.rb index 2db996937..8909b5cd0 100644 --- a/spec/factories/report/realtime/not_authenticateds.rb +++ b/spec/factories/report/realtime/not_authenticateds.rb @@ -157,7 +157,7 @@ # cdr_vendor_id_time_start_idx (vendor_id,time_start) # FactoryBot.define do - factory :not_authenticated, class: Report::Realtime::NotAuthenticated, parent: :cdr do + factory :not_authenticated, class: 'Report::Realtime::NotAuthenticated', parent: :cdr do time_start { 110.seconds.ago.utc } # this record will be available in page during 10 second auth_orig_ip { IPAddr.new(rand(2**32), Socket::AF_INET) } customer_auth_id { nil } diff --git a/spec/factories/report/scheduler_periods.rb b/spec/factories/report/scheduler_periods.rb index 05e7abb24..e76fbcb67 100644 --- a/spec/factories/report/scheduler_periods.rb +++ b/spec/factories/report/scheduler_periods.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :period_scheduler, class: Report::SchedulerPeriod do + factory :period_scheduler, class: 'Report::SchedulerPeriod' do sequence(:id, &:n) sequence(:name) { |n| "Period Scheduler #{n}" } end diff --git a/spec/factories/report/vendor_traffic_schedulers.rb b/spec/factories/report/vendor_traffic_schedulers.rb index 2a8c356b4..55f2a38ee 100644 --- a/spec/factories/report/vendor_traffic_schedulers.rb +++ b/spec/factories/report/vendor_traffic_schedulers.rb @@ -18,7 +18,7 @@ # FactoryBot.define do - factory :vendor_traffic_scheduler, class: Report::VendorTrafficScheduler do + factory :vendor_traffic_scheduler, class: 'Report::VendorTrafficScheduler' do period { Report::SchedulerPeriod.take } vendor end diff --git a/spec/factories/report/vendor_traffics.rb b/spec/factories/report/vendor_traffics.rb index 375c65274..63fa497e0 100644 --- a/spec/factories/report/vendor_traffics.rb +++ b/spec/factories/report/vendor_traffics.rb @@ -14,7 +14,7 @@ # FactoryBot.define do - factory :vendor_traffic, class: Report::VendorTraffic do + factory :vendor_traffic, class: 'Report::VendorTraffic' do date_start { Time.now.utc } date_end { Time.now.utc + 1.week } association :vendor diff --git a/spec/factories/routing/area_prefixes.rb b/spec/factories/routing/area_prefixes.rb index 07262ba39..a39ab4189 100644 --- a/spec/factories/routing/area_prefixes.rb +++ b/spec/factories/routing/area_prefixes.rb @@ -17,7 +17,7 @@ # area_prefixes_area_id_fkey (area_id => areas.id) # FactoryBot.define do - factory :area_prefix, class: Routing::AreaPrefix do + factory :area_prefix, class: 'Routing::AreaPrefix' do sequence(:prefix) { |n| "#{n}#{n + 1}#{n + 2}" } # example: '123', '234'... association :area diff --git a/spec/factories/routing/areas.rb b/spec/factories/routing/areas.rb index 2ee413553..cab861c7f 100644 --- a/spec/factories/routing/areas.rb +++ b/spec/factories/routing/areas.rb @@ -12,7 +12,7 @@ # areas_name_key (name) UNIQUE # FactoryBot.define do - factory :area, class: Routing::Area do + factory :area, class: 'Routing::Area' do sequence(:name) { |n| "Routing_Area_#{n}" } trait :filled do diff --git a/spec/factories/routing/destination_next_rates.rb b/spec/factories/routing/destination_next_rates.rb index e722f6d26..f01c3ee2a 100644 --- a/spec/factories/routing/destination_next_rates.rb +++ b/spec/factories/routing/destination_next_rates.rb @@ -22,7 +22,7 @@ # destination_next_rates_destination_id_fkey (destination_id => destinations.id) # FactoryBot.define do - factory :destination_next_rate, class: Routing::DestinationNextRate do + factory :destination_next_rate, class: 'Routing::DestinationNextRate' do initial_rate { 0 } next_rate { 0 } initial_interval { 5 } diff --git a/spec/factories/routing/destinations.rb b/spec/factories/routing/destinations.rb index eff41e6a5..f0d563e09 100644 --- a/spec/factories/routing/destinations.rb +++ b/spec/factories/routing/destinations.rb @@ -46,7 +46,7 @@ # destinations_routing_tag_mode_id_fkey (routing_tag_mode_id => routing_tag_modes.id) # FactoryBot.define do - factory :destination, aliases: [:rate], class: Routing::Destination do + factory :destination, aliases: [:rate], class: 'Routing::Destination' do sequence(:external_id) prefix { nil } connect_fee { 0 } diff --git a/spec/factories/routing/numberlist_items.rb b/spec/factories/routing/numberlist_items.rb index 37814536a..1a7369003 100644 --- a/spec/factories/routing/numberlist_items.rb +++ b/spec/factories/routing/numberlist_items.rb @@ -34,7 +34,7 @@ # numberlist_items_tag_action_id_fkey (tag_action_id => tag_actions.id) # FactoryBot.define do - factory :numberlist_item, class: Routing::NumberlistItem do + factory :numberlist_item, class: 'Routing::NumberlistItem' do sequence(:key) { |n| "numberlist_item_#{n}" } association :numberlist diff --git a/spec/factories/routing/numberlists.rb b/spec/factories/routing/numberlists.rb index b52ae776e..718934e36 100644 --- a/spec/factories/routing/numberlists.rb +++ b/spec/factories/routing/numberlists.rb @@ -34,7 +34,7 @@ # numberlists_tag_action_id_fkey (tag_action_id => tag_actions.id) # FactoryBot.define do - factory :numberlist, class: Routing::Numberlist do + factory :numberlist, class: 'Routing::Numberlist' do sequence(:name) { |n| "numberlist#{n}" } association :lua_script diff --git a/spec/factories/routing/rate_groups.rb b/spec/factories/routing/rate_groups.rb index a7089f20f..a32b15aa6 100644 --- a/spec/factories/routing/rate_groups.rb +++ b/spec/factories/routing/rate_groups.rb @@ -14,7 +14,7 @@ # rate_groups_name_key (name) UNIQUE # FactoryBot.define do - factory :rate_group, class: Routing::RateGroup do + factory :rate_group, class: 'Routing::RateGroup' do sequence(:name) { |n| "rateplan#{n}" } sequence(:external_id) diff --git a/spec/factories/routing/rateplans.rb b/spec/factories/routing/rateplans.rb index 2905e5c25..b4186d11d 100644 --- a/spec/factories/routing/rateplans.rb +++ b/spec/factories/routing/rateplans.rb @@ -18,7 +18,7 @@ # rateplans_uuid_key (uuid) UNIQUE # FactoryBot.define do - factory :rateplan, class: Routing::Rateplan do + factory :rateplan, class: 'Routing::Rateplan' do sequence(:name) { |n| "rateplan#{n}" } profit_control_mode_id { Routing::RateProfitControlMode::MODE_PER_CALL } diff --git a/spec/factories/routing/routeset_discriminators.rb b/spec/factories/routing/routeset_discriminators.rb index 52c7ef6f6..f0d459913 100644 --- a/spec/factories/routing/routeset_discriminators.rb +++ b/spec/factories/routing/routeset_discriminators.rb @@ -12,7 +12,7 @@ # routeset_discriminators_name_key (name) UNIQUE # FactoryBot.define do - factory :routeset_discriminator, class: Routing::RoutesetDiscriminator do + factory :routeset_discriminator, class: 'Routing::RoutesetDiscriminator' do sequence(:name) { |n| "Discriminator #{n}" } end end diff --git a/spec/factories/routing/routing_groups.rb b/spec/factories/routing/routing_groups.rb index 3ba764e48..6b7969095 100644 --- a/spec/factories/routing/routing_groups.rb +++ b/spec/factories/routing/routing_groups.rb @@ -12,7 +12,7 @@ # routing_groups_name_unique (name) UNIQUE # FactoryBot.define do - factory :routing_group, class: Routing::RoutingGroup do + factory :routing_group, class: 'Routing::RoutingGroup' do sequence(:name) { |n| "routing_group_#{n}" } trait :with_dialpeers do diff --git a/spec/factories/routing/routing_plan_static_routes.rb b/spec/factories/routing/routing_plan_static_routes.rb index 5397e42a2..b782c70a1 100644 --- a/spec/factories/routing/routing_plan_static_routes.rb +++ b/spec/factories/routing/routing_plan_static_routes.rb @@ -23,7 +23,7 @@ # routing_plan_static_routes_vendor_id_fkey (vendor_id => contractors.id) # FactoryBot.define do - factory :routing_plan_static_route, aliases: [:static_route], class: Routing::RoutingPlanStaticRoute do + factory :routing_plan_static_route, aliases: [:static_route], class: 'Routing::RoutingPlanStaticRoute' do prefix { '' } routing_plan { create :routing_plan, :with_static_routes } vendor { FactoryBot.create :vendor } diff --git a/spec/factories/routing/routing_plans.rb b/spec/factories/routing/routing_plans.rb index d627233a8..aa2e2fe9b 100644 --- a/spec/factories/routing/routing_plans.rb +++ b/spec/factories/routing/routing_plans.rb @@ -31,7 +31,7 @@ # routing_plans_src_numberlist_id_fkey (src_numberlist_id => numberlists.id) # FactoryBot.define do - factory :routing_plan, class: Routing::RoutingPlan do + factory :routing_plan, class: 'Routing::RoutingPlan' do sequence(:name) { |n| "routing_plan_#{n}" } sorting_id { Routing::RoutingPlan::SORTING_LCR_PRIO_CONTROL } rate_delta_max { 0 } diff --git a/spec/factories/routing/routing_tag_detection_rules.rb b/spec/factories/routing/routing_tag_detection_rules.rb index 11d2c8120..1167ac34c 100644 --- a/spec/factories/routing/routing_tag_detection_rules.rb +++ b/spec/factories/routing/routing_tag_detection_rules.rb @@ -27,7 +27,7 @@ # FactoryBot.define do - factory :routing_tag_detection_rule, class: Routing::RoutingTagDetectionRule do + factory :routing_tag_detection_rule, class: 'Routing::RoutingTagDetectionRule' do tag_action { Routing::TagAction.clear_action } trait :filled do diff --git a/spec/factories/routing/routing_tags.rb b/spec/factories/routing/routing_tags.rb index 1647007d9..2e7f8d265 100644 --- a/spec/factories/routing/routing_tags.rb +++ b/spec/factories/routing/routing_tags.rb @@ -12,7 +12,7 @@ # routing_tags_name_key (name) UNIQUE # FactoryBot.define do - factory :routing_tag, class: Routing::RoutingTag do + factory :routing_tag, class: 'Routing::RoutingTag' do sequence(:name) { |n| "TAG_#{n}" } initialize_with { Routing::RoutingTag.find_or_create_by(name: name) } diff --git a/spec/factories/routing/tag_actions.rb b/spec/factories/routing/tag_actions.rb index 5c0982f67..b587bfc17 100644 --- a/spec/factories/routing/tag_actions.rb +++ b/spec/factories/routing/tag_actions.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :tag_action, class: Routing::TagAction do + factory :tag_action, class: 'Routing::TagAction' do sequence(:id) { |n| n } sequence(:name) { |n| "Clear tags #{n}" } end diff --git a/spec/factories/rtp_statistics/rx_streams.rb b/spec/factories/rtp_statistics/rx_streams.rb index 1a48a5f22..ad6c6329e 100644 --- a/spec/factories/rtp_statistics/rx_streams.rb +++ b/spec/factories/rtp_statistics/rx_streams.rb @@ -38,7 +38,7 @@ # tx_stream_id :bigint(8) # FactoryBot.define do - factory :rx_stream, class: RtpStatistics::RxStream do + factory :rx_stream, class: 'RtpStatistics::RxStream' do time_start { 1.minute.ago } time_end { 30.seconds.ago } association :pop diff --git a/spec/factories/rtp_statistics/tx_streams.rb b/spec/factories/rtp_statistics/tx_streams.rb index 9f9858fb6..6b9c7e925 100644 --- a/spec/factories/rtp_statistics/tx_streams.rb +++ b/spec/factories/rtp_statistics/tx_streams.rb @@ -34,7 +34,7 @@ # pop_id :integer(4) # FactoryBot.define do - factory :tx_stream, class: RtpStatistics::TxStream do + factory :tx_stream, class: 'RtpStatistics::TxStream' do time_start { 1.minute.ago } time_end { 30.seconds.ago } association :pop diff --git a/spec/factories/stats/active_call_accounts.rb b/spec/factories/stats/active_call_accounts.rb index 21791c6bd..a8e5c7094 100644 --- a/spec/factories/stats/active_call_accounts.rb +++ b/spec/factories/stats/active_call_accounts.rb @@ -16,7 +16,7 @@ # FactoryBot.define do - factory :active_call_account, class: Stats::ActiveCallAccount do + factory :active_call_account, class: 'Stats::ActiveCallAccount' do terminated_count { 0 } originated_count { 0 } end diff --git a/spec/factories/stats/active_call_orig_gateways.rb b/spec/factories/stats/active_call_orig_gateways.rb index 809ece329..32c575e6a 100644 --- a/spec/factories/stats/active_call_orig_gateways.rb +++ b/spec/factories/stats/active_call_orig_gateways.rb @@ -11,7 +11,7 @@ # FactoryBot.define do - factory :stats_active_call_orig_gw, class: Stats::ActiveCallOrigGateway do + factory :stats_active_call_orig_gw, class: 'Stats::ActiveCallOrigGateway' do count { rand(100) } gateway { Gateway.take! || FactoryBot.create(:gateway) } end diff --git a/spec/factories/stats/active_call_term_gateways.rb b/spec/factories/stats/active_call_term_gateways.rb index 5c1d69ecd..6865d9dbe 100644 --- a/spec/factories/stats/active_call_term_gateways.rb +++ b/spec/factories/stats/active_call_term_gateways.rb @@ -11,7 +11,7 @@ # FactoryBot.define do - factory :stats_active_call_term_gw, class: Stats::ActiveCallTermGateway do + factory :stats_active_call_term_gw, class: 'Stats::ActiveCallTermGateway' do count { rand(100) } gateway { Gateway.take! || FactoryBot.create(:gateway) } end diff --git a/spec/factories/stats/active_calls.rb b/spec/factories/stats/active_calls.rb index dc7bc1a67..ccf6e63c4 100644 --- a/spec/factories/stats/active_calls.rb +++ b/spec/factories/stats/active_calls.rb @@ -11,7 +11,7 @@ # FactoryBot.define do - factory :stats_active_call, class: Stats::ActiveCall do + factory :stats_active_call, class: 'Stats::ActiveCall' do count { rand(100) } node { Node.take! || FactoryBot.create(:node) } end diff --git a/spec/factories/stats/customer_auth_stats.rb b/spec/factories/stats/customer_auth_stats.rb index 5066b8d17..3a0aab377 100644 --- a/spec/factories/stats/customer_auth_stats.rb +++ b/spec/factories/stats/customer_auth_stats.rb @@ -19,7 +19,7 @@ # customer_auth_stats_customer_auth_id_timestamp_idx (customer_auth_id,timestamp) UNIQUE # FactoryBot.define do - factory :customer_auth_stats, class: Stats::CustomerAuthStats do + factory :customer_auth_stats, class: 'Stats::CustomerAuthStats' do calls_count { rand(5) } timestamp { Time.now.utc } diff --git a/spec/factories/stats/termination_quality_stats.rb b/spec/factories/stats/termination_quality_stats.rb index 8d92cac56..2abd5574a 100644 --- a/spec/factories/stats/termination_quality_stats.rb +++ b/spec/factories/stats/termination_quality_stats.rb @@ -21,7 +21,7 @@ # FactoryBot.define do - factory :quality_stat, class: Stats::TerminationQualityStat do + factory :quality_stat, class: 'Stats::TerminationQualityStat' do time_start { Time.now.utc } success { true } duration { 2 } diff --git a/spec/factories/system/api_log_configs.rb b/spec/factories/system/api_log_configs.rb index cb881c874..b353adc0f 100644 --- a/spec/factories/system/api_log_configs.rb +++ b/spec/factories/system/api_log_configs.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :api_log_config, class: System::ApiLogConfig do + factory :api_log_config, class: 'System::ApiLogConfig' do sequence(:controller) { |n| "Api::Rest::Private::RateplansController_#{n}" } end end diff --git a/spec/factories/system/cdr_configs.rb b/spec/factories/system/cdr_configs.rb index ca3cbf54a..f7545cd7a 100644 --- a/spec/factories/system/cdr_configs.rb +++ b/spec/factories/system/cdr_configs.rb @@ -19,7 +19,7 @@ # config_vendor_amount_round_mode_id_fkey (vendor_amount_round_mode_id => sys.amount_round_modes.id) # FactoryBot.define do - factory :cdr_config, class: System::CdrConfig do + factory :cdr_config, class: 'System::CdrConfig' do sequence(:id) { |n| n } call_duration_round_mode { System::CdrRoundMode.take || create(:cdr_round_mode, :always_up) } diff --git a/spec/factories/system/cdr_price_round_modes.rb b/spec/factories/system/cdr_price_round_modes.rb index 36734b7ae..72868d70e 100644 --- a/spec/factories/system/cdr_price_round_modes.rb +++ b/spec/factories/system/cdr_price_round_modes.rb @@ -12,7 +12,7 @@ # amount_round_modes_name_key (name) UNIQUE # FactoryBot.define do - factory :cdr_price_round_mode, class: System::CdrPriceRoundMode do + factory :cdr_price_round_mode, class: 'System::CdrPriceRoundMode' do sequence(:id, &:n) sequence(:name) { |n| "Always UP #{n}" } diff --git a/spec/factories/system/cdr_round_modes.rb b/spec/factories/system/cdr_round_modes.rb index e05f6ac11..fd9b416b5 100644 --- a/spec/factories/system/cdr_round_modes.rb +++ b/spec/factories/system/cdr_round_modes.rb @@ -13,7 +13,7 @@ # FactoryBot.define do - factory :cdr_round_mode, class: System::CdrRoundMode do + factory :cdr_round_mode, class: 'System::CdrRoundMode' do id { 3 } # sequence(:id) { |n| n } sequence(:name) { |n| "Always UP #{n}" } diff --git a/spec/factories/system/countries.rb b/spec/factories/system/countries.rb index 97ea60c88..83de93ddd 100644 --- a/spec/factories/system/countries.rb +++ b/spec/factories/system/countries.rb @@ -13,7 +13,7 @@ # countries_name_key (name) UNIQUE # FactoryBot.define do - factory :country, class: System::Country do + factory :country, class: 'System::Country' do name { 'United States' } iso2 { 'US' } diff --git a/spec/factories/system/event_subscriptions.rb b/spec/factories/system/event_subscriptions.rb index e08b1adbb..d3f9c8148 100644 --- a/spec/factories/system/event_subscriptions.rb +++ b/spec/factories/system/event_subscriptions.rb @@ -15,7 +15,7 @@ # FactoryBot.define do - factory :event_subscription, class: System::EventSubscription do + factory :event_subscription, class: 'System::EventSubscription' do sequence(:event) { |n| "DialpeerLocked #{n}" } end end diff --git a/spec/factories/system/lnp_resolvers.rb b/spec/factories/system/lnp_resolvers.rb index 9ce26b4ab..c023f5cd8 100644 --- a/spec/factories/system/lnp_resolvers.rb +++ b/spec/factories/system/lnp_resolvers.rb @@ -15,7 +15,7 @@ # FactoryBot.define do - factory :lnp_resolver, class: System::LnpResolver do + factory :lnp_resolver, class: 'System::LnpResolver' do sequence(:name) { |n| "test_#{n}" } address { 'example.com' } port { 1234 } diff --git a/spec/factories/system/load_balancers.rb b/spec/factories/system/load_balancers.rb index 92a07da51..ed8d3658e 100644 --- a/spec/factories/system/load_balancers.rb +++ b/spec/factories/system/load_balancers.rb @@ -14,7 +14,7 @@ # load_balancers_signalling_ip_key (signalling_ip) UNIQUE # FactoryBot.define do - factory :system_load_balancer, class: System::LoadBalancer do + factory :system_load_balancer, class: 'System::LoadBalancer' do name { 'TEST BALANCER' } signalling_ip { '1.2.3.4' } diff --git a/spec/factories/system/lua_scripts.rb b/spec/factories/system/lua_scripts.rb index f62999485..85bc5a3a8 100644 --- a/spec/factories/system/lua_scripts.rb +++ b/spec/factories/system/lua_scripts.rb @@ -15,7 +15,7 @@ # lua_scripts_name_key (name) UNIQUE # FactoryBot.define do - factory :lua_script, class: System::LuaScript do + factory :lua_script, class: 'System::LuaScript' do sequence(:name) { |n| "LUA script_#{n}" } source { 'arg.a="000"; table.insert(arg.v,9); return arg;' } diff --git a/spec/factories/system/network_prefixes.rb b/spec/factories/system/network_prefixes.rb index b7ddfcb58..5b0c77976 100644 --- a/spec/factories/system/network_prefixes.rb +++ b/spec/factories/system/network_prefixes.rb @@ -25,7 +25,7 @@ # FactoryBot.define do - factory :network_prefix, class: System::NetworkPrefix do + factory :network_prefix, class: 'System::NetworkPrefix' do # Max prefix length in db/network_prefixes.yml is 12. # To avoid duplication we create prefixes wih length 13+. base_prefix = '1' * 12 diff --git a/spec/factories/system/network_types.rb b/spec/factories/system/network_types.rb index b6f101c8a..6117be22d 100644 --- a/spec/factories/system/network_types.rb +++ b/spec/factories/system/network_types.rb @@ -14,7 +14,7 @@ # network_types_uuid_key (uuid) UNIQUE # FactoryBot.define do - factory :network_type, class: System::NetworkType do + factory :network_type, class: 'System::NetworkType' do sequence(:name) { |n| "Network type #{n}" } uuid { SecureRandom.uuid } diff --git a/spec/factories/system/networks.rb b/spec/factories/system/networks.rb index 975aa34aa..d49a7ef73 100644 --- a/spec/factories/system/networks.rb +++ b/spec/factories/system/networks.rb @@ -19,7 +19,7 @@ # networks_type_id_fkey (type_id => network_types.id) # FactoryBot.define do - factory :network, class: System::Network do + factory :network, class: 'System::Network' do name { 'US Eagle Mobile' } network_type { System::NetworkType.take! } uuid { SecureRandom.uuid } diff --git a/spec/factories/system/sensors.rb b/spec/factories/system/sensors.rb index e420245af..e5781d7a3 100644 --- a/spec/factories/system/sensors.rb +++ b/spec/factories/system/sensors.rb @@ -24,7 +24,7 @@ # sensors_mode_id_fkey (mode_id => sensor_modes.id) # FactoryBot.define do - factory :sensor, class: System::Sensor do + factory :sensor, class: 'System::Sensor' do sequence(:name) { |n| "sensor#{n}" } mode_id { 1 } source_interface { nil } diff --git a/spec/factories/system/smtp_connections.rb b/spec/factories/system/smtp_connections.rb index 79dd0eba9..4356ac140 100644 --- a/spec/factories/system/smtp_connections.rb +++ b/spec/factories/system/smtp_connections.rb @@ -19,7 +19,7 @@ # smtp_connections_name_key (name) UNIQUE # FactoryBot.define do - factory :smtp_connection, class: System::SmtpConnection do + factory :smtp_connection, class: 'System::SmtpConnection' do sequence(:name) { |n| "smtp_connection#{n}" } host { 'host' } port { '25' } diff --git a/spec/factories/system/timezones.rb b/spec/factories/system/timezones.rb index 8a8a88461..fdb250e24 100644 --- a/spec/factories/system/timezones.rb +++ b/spec/factories/system/timezones.rb @@ -15,7 +15,7 @@ # timezones_name_key (name) UNIQUE # FactoryBot.define do - factory :timezone, class: System::Timezone do + factory :timezone, class: 'System::Timezone' do sequence(:name) { |n| "TZ#{n}" } sequence(:abbrev) { |n| "TZ#{n}" } utc_offset { 0 }