diff options
| author | Yuval Adam <_@yuv.al> | 2025-07-18 20:18:56 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2025-07-18 20:18:56 +0200 |
| commit | ca13be0eec520edafd513f1d0eee5e863cfacf10 (patch) | |
| tree | 56904c7285cf8f77dcf418c887e7d346ad7b570d | |
| parent | e6eb7ef34a06ece633c5dc961572694d49a46548 (diff) | |
Ruff format
| -rw-r--r-- | regflow/__init__.py | 2 | ||||
| -rwxr-xr-x | regflow/domain_manager.py | 16 | ||||
| -rw-r--r-- | regflow/providers/__init__.py | 2 | ||||
| -rw-r--r-- | regflow/providers/cloudflare_api.py | 4 | ||||
| -rw-r--r-- | regflow/tests/__init__.py | 2 | ||||
| -rw-r--r-- | regflow/tests/test_integration.py | 29 |
6 files changed, 29 insertions, 26 deletions
diff --git a/regflow/__init__.py b/regflow/__init__.py index 1d12396..b4f3579 100644 --- a/regflow/__init__.py +++ b/regflow/__init__.py @@ -1,3 +1,3 @@ """RegFlow - Domain registration and DNS management automation tool.""" -__version__ = "0.1.0"
\ No newline at end of file +__version__ = "0.1.0" diff --git a/regflow/domain_manager.py b/regflow/domain_manager.py index 2f1d15a..fc9d2f0 100755 --- a/regflow/domain_manager.py +++ b/regflow/domain_manager.py @@ -69,14 +69,14 @@ class DomainManager: print(f"✓ Pricing: ${pricing['register']:.2f}, Balance: ${balance:.2f}") # Step 3: User confirmation with multiple safeguards - print(f"\n" + "=" * 50) - print(f"DOMAIN REGISTRATION CONFIRMATION") - print(f"=" * 50) + print("\n" + "=" * 50) + print("DOMAIN REGISTRATION CONFIRMATION") + print("=" * 50) print(f"Domain: {domain}") print(f"Registration Price: ${pricing['register']:.2f}") print(f"Account Balance: ${balance:.2f}") print(f"Remaining Balance: ${balance - pricing['register']:.2f}") - print(f"=" * 50) + print("=" * 50) # Multiple confirmation steps to prevent accidents print( @@ -150,7 +150,7 @@ class DomainManager: # Step 7: Update nameservers in Namecheap if not dry_run: - print(f"Updating nameservers in Namecheap...") + print("Updating nameservers in Namecheap...") try: if not self.namecheap.set_dns_servers(domain, nameservers): result["errors"].append( @@ -159,7 +159,7 @@ class DomainManager: return result result["steps_completed"].append("nameserver_update") - print(f"✓ Nameservers updated in Namecheap") + print("✓ Nameservers updated in Namecheap") except Exception as e: result["errors"].append( f"Failed to update nameservers in Namecheap: {str(e)}" @@ -178,7 +178,7 @@ class DomainManager: dns_records = [] result["dns_records"] = dns_records result["steps_completed"].append("basic_dns_setup") - print(f"✓ Basic DNS records ready (empty list as requested)") + print("✓ Basic DNS records ready (empty list as requested)") except Exception as e: result["errors"].append(f"Failed to set up DNS records: {str(e)}") return result @@ -266,7 +266,7 @@ def main(): if result.get("success"): print(f"\nSuccess! Domain {domain} is ready for use.") else: - print(f"\nErrors occurred:") + print("\nErrors occurred:") for error in result.get("errors", []): print(f" - {error}") sys.exit(1) diff --git a/regflow/providers/__init__.py b/regflow/providers/__init__.py index 1babe54..5e63c72 100644 --- a/regflow/providers/__init__.py +++ b/regflow/providers/__init__.py @@ -1 +1 @@ -"""DNS and domain registration providers."""
\ No newline at end of file +"""DNS and domain registration providers.""" diff --git a/regflow/providers/cloudflare_api.py b/regflow/providers/cloudflare_api.py index e1154f1..3446ba3 100644 --- a/regflow/providers/cloudflare_api.py +++ b/regflow/providers/cloudflare_api.py @@ -24,7 +24,7 @@ class CloudflareAPI: try: response.raise_for_status() - except requests.exceptions.HTTPError as e: + except requests.exceptions.HTTPError: # Try to get the error details from the response try: error_details = response.json() @@ -54,7 +54,7 @@ class CloudflareAPI: raise Exception(f"Cloudflare API Error: {error_msg}") else: raise Exception( - f"Cloudflare API Error: Request failed but no error details provided" + "Cloudflare API Error: Request failed but no error details provided" ) return result diff --git a/regflow/tests/__init__.py b/regflow/tests/__init__.py index a9a6965..0892a2a 100644 --- a/regflow/tests/__init__.py +++ b/regflow/tests/__init__.py @@ -1 +1 @@ -"""Test suite for RegFlow."""
\ No newline at end of file +"""Test suite for RegFlow.""" diff --git a/regflow/tests/test_integration.py b/regflow/tests/test_integration.py index 7cb52b9..4b44471 100644 --- a/regflow/tests/test_integration.py +++ b/regflow/tests/test_integration.py @@ -1,5 +1,4 @@ import pytest -import os from ..config import Config from ..providers.namecheap_api import NamecheapAPI from ..providers.cloudflare_api import CloudflareAPI @@ -34,8 +33,12 @@ def test_namecheap_credentials_loaded(config): def test_cloudflare_credentials_loaded(config): """Test that Cloudflare credentials are loaded""" assert config.cloudflare_api_token, "Cloudflare API token not found" - assert config.cloudflare_api_token != "your_cloudflare_api_token", "Cloudflare API token is placeholder" - assert len(config.cloudflare_api_token) == 40, f"Cloudflare API token should be 40 chars, got {len(config.cloudflare_api_token)}" + assert config.cloudflare_api_token != "your_cloudflare_api_token", ( + "Cloudflare API token is placeholder" + ) + assert len(config.cloudflare_api_token) == 40, ( + f"Cloudflare API token should be 40 chars, got {len(config.cloudflare_api_token)}" + ) def test_namecheap_domain_availability(namecheap_api): @@ -73,7 +76,7 @@ def test_cloudflare_list_zones(cloudflare_api): """Test listing Cloudflare zones""" zones = cloudflare_api.list_zones() assert isinstance(zones, list), "Zones should be a list" - + if zones: zone = zones[0] assert "id" in zone, "Zone should have 'id' field" @@ -83,11 +86,11 @@ def test_cloudflare_list_zones(cloudflare_api): def test_cloudflare_zone_info(cloudflare_api): """Test getting zone information""" zones = cloudflare_api.list_zones() - + if zones: zone_name = zones[0]["name"] zone_info = cloudflare_api.get_zone_info(zone_name) - + assert zone_info is not None, "Zone info should not be None" assert zone_info["name"] == zone_name, "Zone name should match" assert "id" in zone_info, "Zone info should have 'id' field" @@ -96,14 +99,14 @@ def test_cloudflare_zone_info(cloudflare_api): def test_cloudflare_nameservers(cloudflare_api): """Test getting zone nameservers""" zones = cloudflare_api.list_zones() - + if zones: zone_id = zones[0]["id"] nameservers = cloudflare_api.get_zone_nameservers(zone_id) - + assert isinstance(nameservers, list), "Nameservers should be a list" assert len(nameservers) > 0, "Should have at least one nameserver" - + for ns in nameservers: assert isinstance(ns, str), "Nameserver should be a string" assert "cloudflare.com" in ns, "Nameserver should be from Cloudflare" @@ -112,15 +115,15 @@ def test_cloudflare_nameservers(cloudflare_api): def test_cloudflare_dns_records(cloudflare_api): """Test getting DNS records""" zones = cloudflare_api.list_zones() - + if zones: zone_id = zones[0]["id"] records = cloudflare_api.get_zone_dns_records(zone_id) - + assert isinstance(records, list), "DNS records should be a list" - + if records: record = records[0] assert "type" in record, "Record should have 'type' field" assert "name" in record, "Record should have 'name' field" - assert "content" in record, "Record should have 'content' field"
\ No newline at end of file + assert "content" in record, "Record should have 'content' field" |
