Skip to content

Commit

Permalink
add test for ansible inventory (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
kd7lxl authored Dec 31, 2022
1 parent 8ecd776 commit 22deb36
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions portal/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import unittest

from django.core.urlresolvers import reverse
from django.test import TestCase

from dns.models import Record
from portal.models import Host, IPAddress
from portal import views


class AnsibleHostsTest(TestCase):
fixtures = ['domains.json', 'example_host.json']

def test_ansible_hosts_view(self):
response = self.client.get(reverse(views.ansible_hosts))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, '{"name_s1.seattle": ["s1.seattle.hamwan.net"], "os_": ["s1.seattle.hamwan.net"], "type_sector": ["s1.seattle.hamwan.net"], "_meta": {"hostvars": {}}, "owner_": ["s1.seattle.hamwan.net"]}')


class IPAddressTest(TestCase):
Expand Down

0 comments on commit 22deb36

Please sign in to comment.