import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter as pecan

import unittest


class PecanStreetDatasetAdapterTestCase(unittest.TestCase):

    def setUp(self):
        db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
        self.p = pecan(db_url)

    def test_get_table_names(self):
        #tables = self.p.get_table_names('shared')
        pass

    def test_table_metadata(self):
        #tables = self.p.get_table_names('shared')
        #i,a = p.get_table_metadata('shared',str(tables[0]))
        pass

    def test_get_month_traces(self):
        #traces = p.get_month_traces('SharedData',tables[0])
        #trace = p.get_month_traces_wo_time_align('shared',str(tables[0]),i[0])
        pass

if __name__ == '__main__':
    unittest.main()

@@ -82,17 +82,8 @@
 pter
- as pecan
 %0A%0Aim
@@ -281,16 +281,39 @@
 lf.p
+sda
  = 
-p
+P
 ecan
+StreetDatasetAdapter
 (db_
@@ -354,33 +354,34 @@
 (self):%0A        
-#
+s_
 tables = self.p.
@@ -371,32 +371,35 @@
 _tables = self.p
+sda
 .get_table_names
@@ -421,159 +421,781 @@
     
-pass%0A%0A    def test_table_metadata(self):%0A        #tables = self.p.get_table_names('shared
+c_tables = self.psda.get_table_names('curated')%0A        r_tables = self.psda.get_table_names('raw')%0A        self.assertIn('group1_disaggregated_2012_12', c_tables,%0A                      'curated schema has correct tables')%0A        self.assertIn('egauge_15min_2013', r_tables,%0A                      'raw schema has correct tables')%0A        self.assertIn('validated_01_2014', s_tables,%0A                      'shared schema has correct tables
 ')%0A
+%0A
     
-    #i,a = p.get_table_metadata('shared',str(tables%5B0%5D)
+def test_table_metadata(self):%0A        ids,cols = self.psda.get_table_metadata('shared','validated_01_2014')%0A        self.assertIn(744,ids,'shared table 01 2014 has dataid 744')%0A        self.assertIn('use',cols,'shared table 01 2014 has column %22use%22')%0A        self.assertIn('air1',cols,'shared table 01 2014 has column %22air1%22'
 )%0A  

update pecan street adapter tests