- Created comprehensive VISP sync test suite (10 tests, all passing) - Tests Decimal-based MRR calculations (float, integer, nil handling) - Tests API error handling (401, 403, 500, connection errors) - Tests sync status and message updates - Validates financial correctness after float→Decimal refactor - Added GaiiaFixtures module for test support - gaiia_integration_fixture/2 - gaiia_account_fixture/3 - gaiia_inventory_item_fixture/2 - gaiia_network_site_fixture/3 - Extended SnmpFixtures with missing helpers - arp_entry_fixture/2 for ARP table tests - wireless_client_fixture/3 wrapper for positional args - Extended DevicesFixtures and OrganizationsFixtures - device_fixture/3 wrapper (org_id, site_id, attrs) - site_fixture/2 for creating test sites Note: subscriber_matching_test.exs created but has 10 failing tests (testing private functions, missing Repo.query_count/1). Will address separately if needed.
47 lines
1.1 KiB
Elixir
47 lines
1.1 KiB
Elixir
defmodule Towerops.OrganizationsFixtures do
|
|
@moduledoc """
|
|
This module defines test helpers for creating
|
|
entities via the `Towerops.Organizations` context.
|
|
"""
|
|
|
|
alias Towerops.Organizations
|
|
alias Towerops.Sites
|
|
|
|
def unique_organization_name, do: "Test Org #{System.unique_integer()}"
|
|
|
|
def valid_organization_attributes(attrs \\ %{}) do
|
|
Enum.into(attrs, %{
|
|
name: unique_organization_name()
|
|
})
|
|
end
|
|
|
|
def organization_fixture(user_id, attrs \\ %{}) do
|
|
attrs = valid_organization_attributes(attrs)
|
|
|
|
{:ok, organization} = Organizations.create_organization(attrs, user_id, bypass_limits: true)
|
|
|
|
organization
|
|
end
|
|
|
|
def membership_fixture(organization_id, user_id, role) do
|
|
{:ok, membership} =
|
|
Organizations.create_membership(%{
|
|
organization_id: organization_id,
|
|
user_id: user_id,
|
|
role: role
|
|
})
|
|
|
|
membership
|
|
end
|
|
|
|
def site_fixture(organization_id, attrs \\ %{}) do
|
|
attrs =
|
|
Enum.into(attrs, %{
|
|
name: "Test Site #{System.unique_integer()}",
|
|
organization_id: organization_id
|
|
})
|
|
|
|
{:ok, site} = Sites.create_site(attrs)
|
|
site
|
|
end
|
|
end
|