<s> """<STR_LIT>""" <EOL> import mlabconfig <EOL> import StringIO <EOL> import unittest <EOL> from planetlab import model <EOL> import json <EOL> class MlabconfigTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . users = [ ( '<STR_LIT>' , '<STR_LIT:Name>' , '<STR_LIT>' ) ] <EOL> self . sites = [ model . makesite ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> <NUM_LIT> , <NUM_LIT> , self . users , nodegroup = '<STR_LIT>' ) ] <EOL> self . attrs = [ model . Attr ( '<STR_LIT>' , disk_max = '<STR_LIT>' ) ] <EOL> def assertContainsItems ( self , results , expected_items ) : <EOL> """<STR_LIT>""" <EOL> for expected in expected_items : <EOL> self . assertIn ( expected , results ) <EOL> def test_export_mlab_host_ips ( self ) : <EOL> experiments = [ model . Slice ( name = '<STR_LIT>' , index = <NUM_LIT:1> , attrs = self . attrs , <EOL> users = self . users , use_initscript = True , <EOL> ipv6 = '<STR_LIT:all>' ) ] <EOL> for hostname , node in self . sites [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . iteritems ( ) : <EOL> experiments [ <NUM_LIT:0> ] . add_node_address ( node ) <EOL> output = StringIO . StringIO ( ) <EOL> expected_results = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ( '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ] <EOL> mlabconfig . export_mlab_host_ips ( output , self . sites , experiments ) <EOL> results = output . getvalue ( ) . split ( ) <EOL> self . assertItemsEqual ( results , expected_results ) <EOL> def test_export_mlab_site_stats ( self ) : <EOL> output = StringIO . StringIO ( ) <EOL> expected_results = [ { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT:abc>" ] , <EOL> "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT> , "<STR_LIT>" : <NUM_LIT> } ] <EOL> mlabconfig . export_mlab_site_stats ( output , self . sites ) <EOL> results = json . loads ( output . getvalue ( ) ) <EOL> self . assertItemsEqual ( results , expected_results ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
