<s> from django . db . models . loading import cache <EOL> cache . get_apps ( ) <EOL> from freenasUI . api . tests . utils import APITestCase <EOL> from freenasUI . network . models import GlobalConfiguration <EOL> from freenasUI . directoryservice import models <EOL> from freenasUI . storage . models import MountPoint , Volume <EOL> class ActiveDirectoryResourceTest ( APITestCase ) : <EOL> def setUp ( self ) : <EOL> super ( ActiveDirectoryResourceTest , self ) . setUp ( ) <EOL> GlobalConfiguration . objects . create ( ) <EOL> self . _obj = models . ActiveDirectory . objects . create ( ) <EOL> def test_get_list_unauthorzied ( self ) : <EOL> self . assertHttpUnauthorized ( <EOL> self . client . get ( self . get_api_url ( ) , format = '<STR_LIT>' ) <EOL> ) <EOL> def test_Create ( self ) : <EOL> resp = self . api_client . post ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> def test_Retrieve ( self ) : <EOL> resp = self . api_client . get ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data , { <EOL> u'<STR_LIT:id>' : self . _obj . id , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : <NUM_LIT:10> , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : <NUM_LIT:10> , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> } ) <EOL> def test_Update ( self ) : <EOL> resp = self . api_client . put ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , self . _obj . id ) , <EOL> format = '<STR_LIT>' , <EOL> data = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data [ '<STR_LIT:id>' ] , self . _obj . id ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> def test_Delete ( self ) : <EOL> resp = self . api_client . delete ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , <NUM_LIT:1> ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> class LDAPResourceTest ( APITestCase ) : <EOL> def setUp ( self ) : <EOL> super ( LDAPResourceTest , self ) . setUp ( ) <EOL> self . _obj = models . LDAP . objects . create ( ) <EOL> def test_get_list_unauthorzied ( self ) : <EOL> self . assertHttpUnauthorized ( <EOL> self . client . get ( self . get_api_url ( ) , format = '<STR_LIT>' ) <EOL> ) <EOL> def test_Create ( self ) : <EOL> resp = self . api_client . post ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> def test_Retrieve ( self ) : <EOL> resp = self . api_client . get ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data , { <EOL> u'<STR_LIT:id>' : self . _obj . id , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> } ) <EOL> def test_Update ( self ) : <EOL> resp = self . api_client . put ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , self . _obj . id ) , <EOL> format = '<STR_LIT>' , <EOL> data = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data [ '<STR_LIT:id>' ] , self . _obj . id ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> def test_Delete ( self ) : <EOL> resp = self . api_client . delete ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , <NUM_LIT:1> ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> class NISResourceTest ( APITestCase ) : <EOL> def setUp ( self ) : <EOL> super ( NISResourceTest , self ) . setUp ( ) <EOL> self . _obj = models . NIS . objects . create ( ) <EOL> def test_get_list_unauthorzied ( self ) : <EOL> self . assertHttpUnauthorized ( <EOL> self . client . get ( self . get_api_url ( ) , format = '<STR_LIT>' ) <EOL> ) <EOL> def test_Create ( self ) : <EOL> resp = self . api_client . post ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> def test_Retrieve ( self ) : <EOL> resp = self . api_client . get ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data , { <EOL> u'<STR_LIT:id>' : self . _obj . id , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : False , <EOL> } ) <EOL> def test_Update ( self ) : <EOL> resp = self . api_client . put ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , self . _obj . id ) , <EOL> format = '<STR_LIT>' , <EOL> data = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> } <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data [ '<STR_LIT:id>' ] , self . _obj . id ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , True ) <EOL> def test_Delete ( self ) : <EOL> resp = self . api_client . delete ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , <NUM_LIT:1> ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> class NT4ResourceTest ( APITestCase ) : <EOL> def setUp ( self ) : <EOL> super ( NT4ResourceTest , self ) . setUp ( ) <EOL> GlobalConfiguration . objects . create ( ) <EOL> self . _obj = models . NT4 . objects . create ( ) <EOL> def test_get_list_unauthorzied ( self ) : <EOL> self . assertHttpUnauthorized ( <EOL> self . client . get ( self . get_api_url ( ) , format = '<STR_LIT>' ) <EOL> ) <EOL> def test_Create ( self ) : <EOL> resp = self . api_client . post ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) <EOL> def test_Retrieve ( self ) : <EOL> resp = self . api_client . get ( <EOL> self . get_api_url ( ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data , { <EOL> u'<STR_LIT:id>' : self . _obj . id , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : u'<STR_LIT>' , <EOL> u'<STR_LIT>' : False , <EOL> u'<STR_LIT>' : False , <EOL> } ) <EOL> def test_Update ( self ) : <EOL> resp = self . api_client . put ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , self . _obj . id ) , <EOL> format = '<STR_LIT>' , <EOL> data = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> ) <EOL> self . assertHttpOK ( resp ) <EOL> data = self . deserialize ( resp ) <EOL> self . assertEqual ( data [ '<STR_LIT:id>' ] , self . _obj . id ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> def test_Delete ( self ) : <EOL> resp = self . api_client . delete ( <EOL> '<STR_LIT>' % ( self . get_api_url ( ) , <NUM_LIT:1> ) , <EOL> format = '<STR_LIT>' , <EOL> ) <EOL> self . assertHttpMethodNotAllowed ( resp ) </s>
