Mailing List Archive

YAML version of python tests
On Thu, 29 Jun 2006, Stuart D. Gathman wrote:

> I have converted my nascent python test suite to BIND, and then
> converted that to JSON, and then pretty printed the JSON.
> The BIND and json formats are attached.

And here, I call the yaml python libary to output as YAML. Julian
is doing an example also, but this is the same data as the BIND and JSON
formats. Julian can tell me how to get rid of the python specific
types in the output. Since it is so simple to convert between the 3 formats,
we could all edit our favorite format locally, and submit the
agreed upon format to SVN.

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail.example1.com
id: nospace2
ip4: 1.2.3.4
mfrom: foo@example3.com
result: pass
zonedata:
example3.com: !!pairs
- {SPF: v=spf1mx}
- {SPF: v=spf1 mx}
- MX: !!python/tuple [0, mail.example1.com]
example1.com: !!pairs
- {SPF: v=spf1}
example2.com: !!pairs
- {SPF: v=spf1mx}
mail.example1.com: !!pairs
- {A: 1.2.3.4}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail.example1.com
id: nospace1
ip4: 1.2.3.4
mfrom: foo@example2.com
result: none
zonedata:
mail.example1.com: !!pairs
- {A: 1.2.3.4}
example1.com: !!pairs
- {SPF: v=spf1}
example3.com: !!pairs
- {SPF: v=spf1mx}
- {SPF: v=spf1 mx}
- MX: !!python/tuple [0, mail.example1.com]
example2.com: !!pairs
- {SPF: v=spf1mx}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail.example.net
id: exists-pass
ip4: 1.2.3.5
mfrom: lyme.eater@example.co.uk
result: pass
zonedata:
lyme.eater.example.co.uk.1.2.3.5.spf.example.net: !!pairs
- {A: 127.0.0.1}
example.co.uk: !!pairs
- {SPF: 'v=spf1 mx/26 exists:%{l}.%{d}.%{i}.spf.example.net -all'}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail.example.net
id: exists-fail
ip4: 1.2.3.4
mfrom: lyme.eater@example.co.uk
result: fail
zonedata:
lyme.eater.example.co.uk.1.2.3.5.spf.example.net: !!pairs
- {A: 127.0.0.1}
example.co.uk: !!pairs
- {SPF: 'v=spf1 mx/26 exists:%{l}.%{d}.%{i}.spf.example.net -all'}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail.example.com
id: emptyMX
ip4: 1.2.3.4
mfrom: ''
result: neutral
zonedata:
mail.example.com: !!pairs
- MX: !!python/tuple [0, '']
- {SPF: v=spf1 mx}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail.examplea.com
id: incloop
ip4: 66.150.186.79
mfrom: chuckvsr@examplea.com
result: permerror
zonedata:
examplea.com: !!pairs
- {SPF: 'v=spf1 a mx include:b.com'}
exampleb.com: !!pairs
- {SPF: 'v=spf1 a mx include:a.com'}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: msgbas2x.cos.example.com
id: traildot1
ip4: 192.168.218.40
mfrom: test@example.com
result: pass
zonedata:
msgbas1x.cos.example.com: !!pairs
- {A: 192.168.240.36}
example.com: !!pairs
- {A: 192.168.90.76}
- {SPF: 'v=spf1 redirect=%{d}.d.spf.example.com.'}
- MX: !!python/tuple [10, msgbas1x.cos.example.com]
a.spf.example.com: !!pairs
- {SPF: 'v=spf1 mx:example.com include:o.spf.example.com -exists:%{s}.S.bl.spf.example.com
exists:%{s}.S.%{i}.AI.spf.example.com ~all'}
o.spf.example.com: !!pairs
- {SPF: 'v=spf1 ip4:192.168.144.41 ip4:192.168.218.40 ip4:192.168.218.41'}
example.com.d.spf.example.com: !!pairs
- {SPF: v=spf1 redirect=a.spf.example.com}

!!python/object:testspf.SPFTest
filename: test/test.dat
helo: mail1.example1.com
id: empty
ip4: 1.2.3.4
mfrom: foo@example1.com
result: neutral
zonedata:
mail.example1.com: !!pairs
- {A: 1.2.3.4}
example1.com: !!pairs
- {SPF: v=spf1}
example2.com: !!pairs
- {SPF: v=spf1mx}
example3.com: !!pairs
- {SPF: v=spf1mx}
- {SPF: v=spf1 mx}
- MX: !!python/tuple [0, mail.example1.com]


--
Stuart D. Gathman <stuart@bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname=spf-devel@v2.listbox.com
Re: YAML version of python tests [ In reply to ]
On Thu, 29 Jun 2006, Stuart D. Gathman wrote:

> Julian can tell me how to get rid of the python specific
> types in the output.

Ah, it is safe_dump, except that safe_dump doesn't do anchors and
references for multiple tests per zonedata.

--
Stuart D. Gathman <stuart@bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname=spf-devel@v2.listbox.com
Re: YAML version of python tests [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stuart D. Gathman wrote:
> And here, I call the yaml python libary to output as YAML. Julian
> is doing an example also, but this is the same data as the BIND and JSON
> formats. Julian can tell me how to get rid of the python specific
> types in the output.

No, I can't, because that's generator-specific.

> Also, need to add comments to JSON and YAML formats. Need advice on
> best way to do that in YAML. Also, Julian, is there a way to get rid of
> the !!pair in YAML?

Generally yes, those should be redundant. (As for !!python/tuple, that's
obviously Python-specific and most likely is redundant, too.)

> Since it is so simple to convert between the 3 formats, we could all edit
> our favorite format locally, and submit the agreed upon format to SVN.

We could do that, however I'm not sure the benefits outweigh the cost of
having to write conversion scripts. I'll have to look into CPAN's JSON
module.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEpcu1wL7PKlBZWjsRAr/FAKCScP5PUybkFlgP/2MENtfN999mYACgnC9g
0y+Z4A6oijc0rruTUU0tsMg=
=IZnf
-----END PGP SIGNATURE-----

-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname=spf-devel@v2.listbox.com