Commits

Carsten Senger  committed 18d1e63

[tests][xs] move tests into the .legacy package.

cause wdmmgext is a namespace pkg.

  • Participants
  • Parent commits d58f21f

Comments (0)

Files changed (2)

File wdmmgext/legacy/tests/test_legacy.py

+import json
+from wdmmg.tests import *
+import wdmmg.model as model
+import wdmmg.plugins as plugins
+from random import choice
+
+class TestLegacy(TestController):
+
+    @classmethod
+    def setup_class(self):
+        Fixtures.setup()
+        plugins.load('legacy')
+    
+    @classmethod
+    def teardown_class(self):
+        Fixtures.teardown()
+    
+    def test_01_reroute_rest_dataset(self):
+        old_url = '/api/rest/dataset/cra'
+        re_fake = self.app.get(old_url)
+        re_orig = self.app.get(url(controller='dataset', action='view', id='cra', format='json'))
+        assert unicode(re_fake) == unicode(re_orig), (re_orig, re_fake)
+
+    def test_02_reroute_rest_entry(self):
+        entry = model.Entry.find_one()
+        old_url = '/api/rest/entry/%s' % entry.id
+        re_fake = self.app.get(old_url)
+        re_orig = self.app.get(url(controller='entry', action='view', id=str(entry.id), format='json'))
+        assert unicode(re_fake) == unicode(re_orig), (re_orig, re_fake)
+
+    def test_03_key_cofog1(self):
+        cofog1 = '/api/rest/key/cofog1'
+        res = self.app.get(cofog1)
+        key = json.loads(res.body)
+        for k in ['notes', 'id', 'keyvalues', 'name']:
+            assert k in key.keys(), key.keys()
+        assert "10" in key['enumeration_values']
+        ev = key['enumeration_values']['10']
+        for k in ['key_id', 'code', 'id', 'name']: 
+            assert k in ev, ev
+
+    def test_04_key_from(self):
+        cofog1 = '/api/rest/key/from'
+        res = self.app.get(cofog1)
+        key = json.loads(res.body)
+        for k in ['notes', 'id', 'keyvalues', 'name']:
+            assert k in key.keys(), key.keys()
+        assert 'Dept047' in key['enumeration_values']
+    
+    def test_05_key_value_cofog1_10(self):
+        cofog1 = '/api/rest/key/cofog1/value/10'
+        res = self.app.get(cofog1)
+        val = json.loads(res.body)
+        for k in ['notes', 'id', 'code', 'keyvalues', 'name']:
+            assert k in val.keys(), (k, val.keys())
+        key = val['key']
+        for k in ['id', 'keyvalues', 'name']:
+            assert k in key.keys(), (k, key.keys())
+

File wdmmgext/tests/test_legacy.py

-import json
-from wdmmg.tests import *
-import wdmmg.model as model
-import wdmmg.plugins as plugins
-from random import choice
-
-class TestLegacy(TestController):
-
-    @classmethod
-    def setup_class(self):
-        Fixtures.setup()
-        plugins.load('legacy')
-    
-    @classmethod
-    def teardown_class(self):
-        Fixtures.teardown()
-    
-    def test_01_reroute_rest_dataset(self):
-        old_url = '/api/rest/dataset/cra'
-        re_fake = self.app.get(old_url)
-        re_orig = self.app.get(url(controller='dataset', action='view', id='cra', format='json'))
-        assert unicode(re_fake) == unicode(re_orig), (re_orig, re_fake)
-
-    def test_02_reroute_rest_entry(self):
-        entry = model.Entry.find_one()
-        old_url = '/api/rest/entry/%s' % entry.id
-        re_fake = self.app.get(old_url)
-        re_orig = self.app.get(url(controller='entry', action='view', id=str(entry.id), format='json'))
-        assert unicode(re_fake) == unicode(re_orig), (re_orig, re_fake)
-
-    def test_03_key_cofog1(self):
-        cofog1 = '/api/rest/key/cofog1'
-        res = self.app.get(cofog1)
-        key = json.loads(res.body)
-        for k in ['notes', 'id', 'keyvalues', 'name']:
-            assert k in key.keys(), key.keys()
-        assert "10" in key['enumeration_values']
-        ev = key['enumeration_values']['10']
-        for k in ['key_id', 'code', 'id', 'name']: 
-            assert k in ev, ev
-
-    def test_04_key_from(self):
-        cofog1 = '/api/rest/key/from'
-        res = self.app.get(cofog1)
-        key = json.loads(res.body)
-        for k in ['notes', 'id', 'keyvalues', 'name']:
-            assert k in key.keys(), key.keys()
-        assert 'Dept047' in key['enumeration_values']
-    
-    def test_05_key_value_cofog1_10(self):
-        cofog1 = '/api/rest/key/cofog1/value/10'
-        res = self.app.get(cofog1)
-        val = json.loads(res.body)
-        for k in ['notes', 'id', 'code', 'keyvalues', 'name']:
-            assert k in val.keys(), (k, val.keys())
-        key = val['key']
-        for k in ['id', 'keyvalues', 'name']:
-            assert k in key.keys(), (k, key.keys())
-