#NEWLINE# def test_create_with_one_hwadapter( self ) : #NEWLINE# #INDENT# test_data = json . loads ( '{{\n            "hwadapters-TOTAL_FORMS": ["1"],\n            "hwadapters-MAX_NUM_FORMS": [""],\n            "hwadapters-INITIAL_FORMS": ["0"],\n            "sreg-views": ["2"],\n            "sreg-fqdn": ["test2.foo.com"],\n            "sreg-ip_str": ["10.8.0.3"],\n            "override-fqdn": ["on"],\n            "sreg-system": ["{system_pk}"],\n            "hwadapters-0-name": ["hw0"],\n            "hwadapters-0-mac": ["11:22:33:44:55:66"],\n            "kv-hwadapters-0-hostname": ["valid.mozilla.com"]}}\n        ' . format ( system_pk = self . s . pk ) ) #NEWLINE# count_before = StaticReg . objects . all ( ) . count ( ) #NEWLINE# resp = self . client . post ( '/en-US/core/registration/static/create/' , resp ) #NEWLINE# self . assertEqual ( 200 , resp . status_code ) #NEWLINE# count_after = StaticReg . objects . all ( ) . count ( ) #NEWLINE# self . assertEqual ( ( count_before + 1 ) , count_after ) #NEWLINE# sreg = StaticReg . objects . get ( fqdn = 'test2.foo.com' ) #NEWLINE# self . assertEqual ( 1 , sreg . views . all ( ) . count ( ) ) #NEWLINE# self . assertEqual ( '10.8.0.3' , sreg . ip_str ) #NEWLINE# self . assertEqual ( 0 , sreg . keyvalue_set . all ( ) . count ( ) ) #NEWLINE# self . assertEqual ( 1 , sreg . hwadapter_set . all ( ) . count ( ) ) #NEWLINE# hw = sreg . hwadapter_set . all ( ) [ 0 ] #NEWLINE# self . assertEqual ( '11:22:33:44:55:66' , hw . mac ) #NEWLINE# self . assertEqual ( 'hw0' , hw . name ) #NEWLINE# self . assertEqual ( 1 , hw . keyvalue_set . all ( ) . count ( ) ) #NEWLINE# kv = hw . keyvalue_set . all ( ) [ 0 ] #NEWLINE# self . assertEqual ( 'hostname' , kv . key ) #NEWLINE# self . assertEqual ( 'valid.mozilla.com' , kv . value )