Félix Baylac-Jacqué 6 years ago
parent
commit
e642897d01
3 changed files with 15 additions and 3 deletions
  1. 8 1
      TODO.org
  2. 3 0
      ffdnispdb/models.py
  3. 4 2
      test_ffdnispdb.py

+ 8 - 1
TODO.org

@@ -87,9 +87,16 @@
            #+END_CODE
          - [X] Try to insert that in the DB
          - [ ] Check whether this geoJSON has also been inserted in its own table.
+           - It has its own table called CoveredAreas
+             - [ ] How did stuff end up in here?
+               This data is duplicated in the DB. It belongs both in the JSON model of IPS
+               and its own CoveredAreas.
+
+               Everything seems to be synchronized though a =pre_save= hook on the ISP model.
+               =_sync_covered_areas= is in charge of synchronising both the covered areas and the
+               Office Location.
        - [ ] How is this database created?
             Is it the same sqlite database as the main one?
-
    - [ ] Fix the test, if needed.
 ** TODO Test the remote fetching scrapper for the 0.2 format [0%]
    - [ ] Write a test using an example coming from the fdn json format repo.

+ 3 - 0
ffdnispdb/models.py

@@ -187,6 +187,9 @@ class RegisteredOffice(db.Model):
     isp_id = db.Column(db.Integer, db.ForeignKey('isp.id'))
     point = geo.GeometryColumn(geo.Point(0))
 
+    def __repr__(self):
+        return u'<RegisteredOffice %r>' % (self.isp_id.name)
+
 geo.GeometryDDL(RegisteredOffice.__table__)
 
 

+ 4 - 2
test_ffdnispdb.py

@@ -6,6 +6,7 @@ from flask.ext.sqlalchemy import SQLAlchemy
 import unittest
 import doctest
 import json
+import sys
 
 
 
@@ -77,7 +78,7 @@ class TestCase(unittest.TestCase):
         test_cfg={
             'TESTING': True,
             'WTF_CSRF_ENABLED': False,
-            'SQLALCHEMY_DATABASE_URI': 'sqlite://',
+            'SQLALCHEMY_DATABASE_URI': 'sqlite:///',
         }
         test_cfg.update(kwargs)
         return create_app(test_cfg)
@@ -86,7 +87,8 @@ class TestCase(unittest.TestCase):
         self.app = self.create_app()
         self.client = self.app.test_client()
         with self.app.app_context():
-            db.create_all()
+           print(db)
+           db.create_all()
         self._ctx = self.app.test_request_context()
         self._ctx.push()