systems.tests.utils.create_fake_host

Here are the examples of the python api systems.tests.utils.create_fake_host taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

84 Examples 7

Example 1

Project: inventory
Source File: basic.py
View license
    def setUp(self):
        self.num = 0
        create_fake_zone('2.ip6.arpa', suffix="")
        self.domain = create_fake_zone('foo.mozilla.com', suffix='')
        self.s = create_fake_host(hostname='foo.mozilla.com')
        self.sreg = StaticReg.objects.create(
            label='', domain=self.domain, ip_str='2222:123::', ip_type='6',
            system=self.s
        )
        self.s = create_fake_host(hostname='foobar.mozilla.com')
        self.g = Group.objects.create(name='foobar')
        super(HWAdapterTest, self).setUp()

Example 2

Project: inventory
Source File: exporter.py
View license
    def setUp(self):
        create_fake_host(hostname='foobob1.mozilla.com', serial='1234')
        create_fake_host(hostname='foobob2.mozilla.com', serial='1235')
        create_fake_host(hostname='foobob3.mozilla.com', serial='1236')
        UserLicense.objects.create()
        self.client = Client()

Example 3

Project: inventory
Source File: tests.py
View license
    def setUp(self):
        create_fake_zone('10.in-addr.arpa', suffix='')
        self.domain = create_fake_zone('foo.mozilla.com', suffix='')
        self.s = create_fake_host(hostname='foo.mozilla.com')
        self.sreg = StaticReg.objects.create(
            label='', domain=self.domain, ip_str='10.0.0.1', ip_type='4',
            system=self.s
        )

Example 4

Project: inventory
Source File: system_integration.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 5

Project: inventory
Source File: A_tests.py
View license
    def setUp(self):
        Domain.objects.all().delete()
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 6

Project: inventory
Source File: importer.py
View license
    def test_primary_attribute3(self):
        create_fake_host(
            hostname='foobob.mozilla.com', serial='SC07HT03WDKDJ'
        )
        test_csv = """
        primary_attribute%serial,warranty_start,warranty_end,purchase_date,system_type%type_name,allocation%name
        SC07HT03WDKDJ,2012-06-06,2013-06-06,2012-06-06,foobar,something
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(serial='SC07HT03WDKDJ')
        self.assertEqual(
            datetime.datetime(2012, 6, 6, 0, 0).date(), s1.warranty_start)
        self.assertEqual(
            datetime.datetime(2013, 6, 6, 0, 0).date(), s1.warranty_end)

Example 7

Project: inventory
Source File: deletetion.py
View license
    def test1_delete_basic(self):
        # Does deleting a system delete it's interfaces?
        label = "foo"
        domain = self.f_c
        ip_str = "10.0.0.2"
        system = create_fake_host(hostname="foo")
        system.save()
        kwargs = {
            'label': label, 'domain': domain, 'ip_str': ip_str,
            'system': system}
        self.do_add(**kwargs)
        self.assertTrue(StaticReg.objects.filter(**kwargs))
        system.delete()
        self.assertFalse(StaticReg.objects.filter(**kwargs))

Example 8

Project: inventory
Source File: importer.py
View license
    def test_system_type(self):
        create_fake_host(
            hostname='foobob1.mozilla.com', serial='xxx'
        )
        test_csv = """
        hostname, system_type % type_name
        foobob1.mozilla.com, foobar
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(hostname='foobob1.mozilla.com')
        self.assertEqual(s1.system_type.type_name, 'foobar')

Example 9

Project: inventory
Source File: importer.py
View license
    def test_primary_attribute(self):
        s = create_fake_host(hostname='foobob.mozilla.com')
        test_csv = """
        primary_attribute%hostname,hostname,warranty_start,warranty_end,serial,system_type%type_name,allocation%name
        foobob.mozilla.com,foobar.mozilla.com,2012-01-01,2012-01-01,asdf,foobar,something
        """
        self.client_tst(test_csv, save=True, primary_attr='asset_tag')
        # The primary_attr kwarg shouldn't affect anything

        s1 = System.objects.get(pk=s.pk)
        self.assertEqual('foobar.mozilla.com', s1.hostname)

Example 10

Project: inventory
Source File: tests.py
View license
    def setUp(self):
        create_fake_zone('10.in-addr.arpa', suffix='')
        self.domain = create_fake_zone('foo.mozilla.com', suffix='')
        self.s = create_fake_host(hostname='foo.mozilla.com')
        self.sreg = StaticReg.objects.create(
            label='', domain=self.domain, ip_str='10.0.0.1', ip_type='4',
            system=self.s
        )

Example 11

Project: inventory
Source File: ipv6_basic.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='ip6.arpa', ip_type='6')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="0", ip_type='6')
        self.r1.save()
        self.r2 = self.create_domain(name="1", ip_type='6')
        self.r2.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 12

Project: inventory
Source File: CNAME_tests.py
View license
    def setUp(self):
        Domain.objects.all().delete()
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 13

Project: inventory
Source File: basic.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()

        self.r2 = self.create_domain(name="128")
        self.r2.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()
        View.objects.get_or_create(name="private")

Example 14

Project: inventory
Source File: test_system_search.py
View license
    def setUp(self):
        System.objects.all().delete()
        self.hostname = "searching.mozilla.com"
        self.notes = "foo bar baz"
        s = create_fake_host(hostname=self.hostname)
        s.notes = self.notes
        s.save()
        self.status = s.system_status.status

Example 15

Project: inventory
Source File: importer.py
View license
    def test_two_switches(self):
        create_fake_host(
            hostname='foobob.mozilla.com', serial='xxx'
        )
        test_csv = """
        primary_attribute%serial,switch_ports,ram
        xxx,"switch1.r101-10:xe-0/0/36,switch1.r101-10:xe-1/0/36",1000
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(serial='xxx')
        self.assertEqual(
            s1.switch_ports,
            "switch1.r101-10:xe-0/0/36,switch1.r101-10:xe-1/0/36"
        )

Example 16

Project: inventory
Source File: deletetion.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()
        View.objects.get_or_create(name="private")

Example 17

Project: inventory
Source File: importer.py
View license
    def test_override(self):
        test_csv = """
        hostname,warranty_start,warranty_end,serial,system_type%type_name,allocation%name
        foobob.mozilla.com,2011-03-01,2012-03-12,asdf,foobar,something
        """
        s = create_fake_host(hostname='foobob.mozilla.com', serial='1234')
        self.client_tst(test_csv, save=True)
        s = System.objects.get(hostname='foobob.mozilla.com')
        self.assertTrue(s.serial, '1234')

Example 18

Project: inventory
Source File: ipv6_basic.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='ip6.arpa', ip_type='6')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="0", ip_type='6')
        self.r1.save()
        self.r2 = self.create_domain(name="1", ip_type='6')
        self.r2.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 19

Project: inventory
Source File: importer.py
View license
    def test_primary_attribute2(self):
        create_fake_host(
            hostname='foobob.mozilla.com', asset_tag='YM0090PW9G6'
        )
        test_csv = """
        primary_attribute%asset_tag,warranty_start,warranty_end,purchase_date,serial,system_type%type_name,allocation%name
        YM0090PW9G6,2010-03-24,2013-03-24,2010-03-24,asdf,foobar,something
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(asset_tag='YM0090PW9G6')
        self.assertTrue(s1.warranty_start)
        self.assertTrue(s1.warranty_end)

Example 20

Project: inventory
Source File: importer.py
View license
    def test_override_spaces(self):
        test_csv = """
        hostname , warranty_start,  warranty_end, serial,system_type%type_name,allocation%name
        foobob.mozilla.com,   2011-03-01 , 2012-03-12,asdf,foobar,something
        """
        s = create_fake_host(hostname='foobob.mozilla.com', serial='1234')
        self.client_tst(test_csv, save=True)
        s = System.objects.get(hostname='foobob.mozilla.com')
        self.assertTrue(s.serial, '1234')

Example 21

Project: inventory
Source File: importer.py
View license
    def test_primary_attribute2(self):
        create_fake_host(
            hostname='foobob.mozilla.com', asset_tag='YM0090PW9G6'
        )
        test_csv = """
        primary_attribute%asset_tag,warranty_start,warranty_end,purchase_date,serial,system_type%type_name,allocation%name
        YM0090PW9G6,2010-03-24,2013-03-24,2010-03-24,asdf,foobar,something
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(asset_tag='YM0090PW9G6')
        self.assertTrue(s1.warranty_start)
        self.assertTrue(s1.warranty_end)

Example 22

Project: inventory
Source File: aux_attrs.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 23

Project: inventory
Source File: importer.py
View license
    def test_primary_attribute3(self):
        create_fake_host(
            hostname='foobob.mozilla.com', serial='SC07HT03WDKDJ'
        )
        test_csv = """
        primary_attribute%serial,warranty_start,warranty_end,purchase_date,system_type%type_name,allocation%name
        SC07HT03WDKDJ,2012-06-06,2013-06-06,2012-06-06,foobar,something
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(serial='SC07HT03WDKDJ')
        self.assertEqual(
            datetime.datetime(2012, 6, 6, 0, 0).date(), s1.warranty_start)
        self.assertEqual(
            datetime.datetime(2013, 6, 6, 0, 0).date(), s1.warranty_end)

Example 24

Project: inventory
Source File: basic.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()

        self.r2 = self.create_domain(name="128")
        self.r2.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()
        View.objects.get_or_create(name="private")

Example 25

Project: inventory
Source File: basic.py
View license
    def setUp(self):
        self.num = 0
        create_fake_zone('2.ip6.arpa', suffix="")
        self.domain = create_fake_zone('foo.mozilla.com', suffix='')
        self.s = create_fake_host(hostname='foo.mozilla.com')
        self.sreg = StaticReg.objects.create(
            label='', domain=self.domain, ip_str='2222:123::', ip_type='6',
            system=self.s
        )
        self.s = create_fake_host(hostname='foobar.mozilla.com')
        self.g = Group.objects.create(name='foobar')
        super(HWAdapterTest, self).setUp()

Example 26

Project: inventory
Source File: deletetion.py
View license
    def test1_delete_basic(self):
        # Does deleting a system delete it's interfaces?
        label = "foo"
        domain = self.f_c
        ip_str = "10.0.0.2"
        system = create_fake_host(hostname="foo")
        system.save()
        kwargs = {
            'label': label, 'domain': domain, 'ip_str': ip_str,
            'system': system}
        self.do_add(**kwargs)
        self.assertTrue(StaticReg.objects.filter(**kwargs))
        system.delete()
        self.assertFalse(StaticReg.objects.filter(**kwargs))

Example 27

Project: inventory
Source File: aux_attrs.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 28

Project: inventory
Source File: A_tests.py
View license
    def setUp(self):
        Domain.objects.all().delete()
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 29

Project: inventory
Source File: PTR_tests.py
View license
    def setUp(self):
        Domain.objects.all().delete()
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 30

Project: inventory
Source File: tests.py
View license
    def setUp(self):
        self.c = Client()
        create_fake_zone('10.in-addr.arpa', suffix='')
        root_domain = create_fake_zone('foobar.mozilla.com', suffix='')
        system = create_fake_host(hostname="asdf.mozilla.com")
        sreg = StaticReg.objects.create(
            label='foo', domain=root_domain, system=system,
            ip_type='4', ip_str='10.0.0.0'
        )

        g = Group.objects.create(name="foo")

        self.test_objs = (
            ('groupkeyvalue', g),
            ('staticregkeyvalue', sreg),
            ('keyvalue', system),
        )

Example 31

Project: inventory
Source File: view_tests.py
View license
    def setUp(self):
        View.objects.create(name="public")
        View.objects.create(name="private")
        self.d = create_fake_zone('foo.com', suffix="")
        self.rd = create_fake_zone('10.in-addr.arpa', suffix="")
        self.client = Client()
        self.s = create_fake_host(hostname='exists.mozilla.com')

Example 32

Project: inventory
Source File: CNAME_tests.py
View license
    def setUp(self):
        Domain.objects.all().delete()
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 33

Project: inventory
Source File: test_system_search.py
View license
    def setUp(self):
        System.objects.all().delete()
        self.hostname = "searching.mozilla.com"
        self.notes = "foo bar baz"
        s = create_fake_host(hostname=self.hostname)
        s.notes = self.notes
        s.save()
        self.status = s.system_status.status

Example 34

Project: inventory
Source File: importer.py
View license
    def test_quoted(self):
        create_fake_host(
            hostname='foobob.mozilla.com', serial='xxx'
        )
        test_csv = """
        hostname, switch_ports
        foobob.mozilla.com, "sdf,asfd,asfd"
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(hostname='foobob.mozilla.com')
        self.assertEqual(s1.switch_ports, 'sdf,asfd,asfd')

Example 35

Project: inventory
Source File: test_api.py
View license
    def test_import_add_system(self):
        # export, add one system, assert the sytem was added
        original = self.get_service(self.s1.iql_stmt())

        s = create_fake_host(hostname='hihihi.mozilla.com')

        original['services'][0]['systems'].append(s.hostname)

        self.assertFalse(self.s1.systems.filter(hostname=s.hostname).exists())

        _, resp = self.import_services(original)
        self.assertEqual(resp.status_code, 200, resp.content)

        self.assertTrue(self.s1.systems.filter(hostname=s.hostname).exists())

Example 36

Project: inventory
Source File: importer.py
View license
    def test_override_spaces(self):
        test_csv = """
        hostname , warranty_start,  warranty_end, serial,system_type%type_name,allocation%name
        foobob.mozilla.com,   2011-03-01 , 2012-03-12,asdf,foobar,something
        """
        s = create_fake_host(hostname='foobob.mozilla.com', serial='1234')
        self.client_tst(test_csv, save=True)
        s = System.objects.get(hostname='foobob.mozilla.com')
        self.assertTrue(s.serial, '1234')

Example 37

Project: inventory
Source File: exporter.py
View license
    def setUp(self):
        create_fake_host(hostname='foobob1.mozilla.com', serial='1234')
        create_fake_host(hostname='foobob2.mozilla.com', serial='1235')
        create_fake_host(hostname='foobob3.mozilla.com', serial='1236')
        UserLicense.objects.create()
        self.client = Client()

Example 38

Project: inventory
Source File: importer.py
View license
    def test_primary_attribute(self):
        s = create_fake_host(hostname='foobob.mozilla.com')
        test_csv = """
        primary_attribute%hostname,hostname,warranty_start,warranty_end,serial,system_type%type_name,allocation%name
        foobob.mozilla.com,foobar.mozilla.com,2012-01-01,2012-01-01,asdf,foobar,something
        """
        self.client_tst(test_csv, save=True, primary_attr='asset_tag')
        # The primary_attr kwarg shouldn't affect anything

        s1 = System.objects.get(pk=s.pk)
        self.assertEqual('foobar.mozilla.com', s1.hostname)

Example 39

Project: inventory
Source File: test_api.py
View license
    def test_import_add_system(self):
        # export, add one system, assert the sytem was added
        original = self.get_service(self.s1.iql_stmt())

        s = create_fake_host(hostname='hihihi.mozilla.com')

        original['services'][0]['systems'].append(s.hostname)

        self.assertFalse(self.s1.systems.filter(hostname=s.hostname).exists())

        _, resp = self.import_services(original)
        self.assertEqual(resp.status_code, 200, resp.content)

        self.assertTrue(self.s1.systems.filter(hostname=s.hostname).exists())

Example 40

Project: inventory
Source File: importer.py
View license
    def test_quoted(self):
        create_fake_host(
            hostname='foobob.mozilla.com', serial='xxx'
        )
        test_csv = """
        hostname, switch_ports
        foobob.mozilla.com, "sdf,asfd,asfd"
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(hostname='foobob.mozilla.com')
        self.assertEqual(s1.switch_ports, 'sdf,asfd,asfd')

Example 41

Project: inventory
Source File: PTR_tests.py
View license
    def setUp(self):
        Domain.objects.all().delete()
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 42

Project: inventory
Source File: importer.py
View license
    def test_system_type(self):
        create_fake_host(
            hostname='foobob1.mozilla.com', serial='xxx'
        )
        test_csv = """
        hostname, system_type % type_name
        foobob1.mozilla.com, foobar
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(hostname='foobob1.mozilla.com')
        self.assertEqual(s1.system_type.type_name, 'foobar')

Example 43

Project: inventory
Source File: importer.py
View license
    def test_override(self):
        test_csv = """
        hostname,warranty_start,warranty_end,serial,system_type%type_name,allocation%name
        foobob.mozilla.com,2011-03-01,2012-03-12,asdf,foobar,something
        """
        s = create_fake_host(hostname='foobob.mozilla.com', serial='1234')
        self.client_tst(test_csv, save=True)
        s = System.objects.get(hostname='foobob.mozilla.com')
        self.assertTrue(s.serial, '1234')

Example 44

Project: inventory
Source File: system_integration.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()

Example 45

Project: inventory
Source File: tests.py
View license
    def setUp(self):
        self.g = create_fake_zone("gz", suffix="")
        self.c_g = create_fake_zone("coo.gz", suffix="")
        self.d = create_fake_zone("dz", suffix="")

        self.r1 = create_fake_zone("10.in-addr.arpa", suffix="")
        self.r1.save()

        self.s = create_fake_host(hostname="foo.mozilla.com")
        self.s.save()

Example 46

Project: inventory
Source File: tests.py
View license
    def setUp(self):
        self.g = create_fake_zone("gz", suffix="")
        self.c_g = create_fake_zone("coo.gz", suffix="")
        self.d = create_fake_zone("dz", suffix="")

        self.r1 = create_fake_zone("10.in-addr.arpa", suffix="")
        self.r1.save()

        self.s = create_fake_host(hostname="foo.mozilla.com")
        self.s.save()

Example 47

Project: inventory
Source File: importer.py
View license
    def test_two_switches(self):
        create_fake_host(
            hostname='foobob.mozilla.com', serial='xxx'
        )
        test_csv = """
        primary_attribute%serial,switch_ports,ram
        xxx,"switch1.r101-10:xe-0/0/36,switch1.r101-10:xe-1/0/36",1000
        """
        self.client_tst(test_csv, save=True)
        # The primary_attr kwarg shouldn't affect anything
        s1 = System.objects.get(serial='xxx')
        self.assertEqual(
            s1.switch_ports,
            "switch1.r101-10:xe-0/0/36,switch1.r101-10:xe-1/0/36"
        )

Example 48

Project: inventory
Source File: view_tests.py
View license
    def setUp(self):
        View.objects.create(name="public")
        View.objects.create(name="private")
        self.d = create_fake_zone('foo.com', suffix="")
        self.rd = create_fake_zone('10.in-addr.arpa', suffix="")
        self.client = Client()
        self.s = create_fake_host(hostname='exists.mozilla.com')

Example 49

Project: inventory
Source File: tests.py
View license
    def setUp(self):
        self.c = Client()
        create_fake_zone('10.in-addr.arpa', suffix='')
        root_domain = create_fake_zone('foobar.mozilla.com', suffix='')
        system = create_fake_host(hostname="asdf.mozilla.com")
        sreg = StaticReg.objects.create(
            label='foo', domain=root_domain, system=system,
            ip_type='4', ip_str='10.0.0.0'
        )

        g = Group.objects.create(name="foo")

        self.test_objs = (
            ('groupkeyvalue', g),
            ('staticregkeyvalue', sreg),
            ('keyvalue', system),
        )

Example 50

Project: inventory
Source File: deletetion.py
View license
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()

        self.c = Domain(name="ccc")
        self.c.save()
        self.f_c = Domain(name="foo.ccc")
        self.f_c.save()
        self.r1 = self.create_domain(name="10")
        self.r1.save()
        self.n = create_fake_host(hostname="foo.mozilla.com")
        self.n.clean()
        self.n.save()
        View.objects.get_or_create(name="private")