def test_daily_export(self): CellFactory.create_batch(10, radio=Radio.gsm) self.session.commit() with mock_s3() as mock_key: export_modified_cells(bucket='localhost.bucket', hourly=False) pat = r'MLS-full-cell-export-\d+-\d+-\d+T000000\.csv\.gz' self.assertRegexpMatches(mock_key.key, pat) method = mock_key.set_contents_from_filename self.assertRegexpMatches(method.call_args[0][0], pat)
def test_daily_export(self): session = self.db_master_session gsm = RADIO_TYPE['gsm'] k = dict(radio=gsm, mcc=1, mnc=2, lac=4, lat=1.0, lon=2.0) for i in range(190, 200): session.add(Cell(cid=i, **k)) session.commit() with mock_s3() as mock_key: export_modified_cells(bucket="localhost.bucket", hourly=False) pat = r"MLS-full-cell-export-\d+-\d+-\d+T000000\.csv\.gz" self.assertRegexpMatches(mock_key.key, pat) method = mock_key.set_contents_from_filename self.assertRegexpMatches(method.call_args[0][0], pat)
def test_hourly_export(self): session = self.session k = {'radio': Radio.gsm, 'mcc': 1, 'mnc': 2, 'lac': 4, 'psc': -1, 'lat': 1.0, 'lon': 2.0} for i in range(190, 200): session.add(Cell(cid=i, **k)) session.commit() with mock_s3() as mock_key: export_modified_cells(bucket='localhost.bucket') pat = r'MLS-diff-cell-export-\d+-\d+-\d+T\d+0000\.csv\.gz' self.assertRegexpMatches(mock_key.key, pat) method = mock_key.set_contents_from_filename self.assertRegexpMatches(method.call_args[0][0], pat)
def test_daily_export(self): session = self.session k = { 'radio': Radio.gsm, 'mcc': 1, 'mnc': 2, 'lac': 4, 'lat': 1.0, 'lon': 2.0 } for i in range(190, 200): session.add(Cell(cid=i, **k)) session.commit() with mock_s3() as mock_key: export_modified_cells(bucket='localhost.bucket', hourly=False) pat = r'MLS-full-cell-export-\d+-\d+-\d+T000000\.csv\.gz' self.assertRegexpMatches(mock_key.key, pat) method = mock_key.set_contents_from_filename self.assertRegexpMatches(method.call_args[0][0], pat)
def test_hourly_export(self): session = self.db_master_session gsm = RADIO_TYPE['gsm'] k = { 'radio': gsm, 'mcc': 1, 'mnc': 2, 'lac': 4, 'psc': -1, 'lat': 1.0, 'lon': 2.0 } for i in range(190, 200): session.add(Cell(cid=i, **k)) session.commit() with mock_s3() as mock_key: export_modified_cells(bucket='localhost.bucket') pat = r'MLS-diff-cell-export-\d+-\d+-\d+T\d+0000\.csv\.gz' self.assertRegexpMatches(mock_key.key, pat) method = mock_key.set_contents_from_filename self.assertRegexpMatches(method.call_args[0][0], pat)