def test_submitted_point_url(self): self.app.config['OSM_API'] = 'fake.api.example.com' p_id = database.add_point(46.06, 24.10, 'EdW', '', 'pub', 'my-open-id') database.set_point_field(p_id, 'osm_id', 1234) client = self.app.test_client() client.post('/test_login', data={'user_id': 'admin-user'}) response = client.get('/points/%d' % p_id) url = 'http://fake.api.example.com/browse/node/1234' self.assertIn('<a href="%s">' % url, response.data)
def test_submit_already_submitted_point(self, mock_get_osm_api): client = self.app.test_client() client.post('/test_login', data={'user_id': 'admin-user'}) p_id = database.add_point(45, 25, 'name', 'url', 'type', 'admin-user') database.set_point_field(p_id, 'osm_id', 100) address = flask.url_for('.send_point', point_id=p_id) response = client.post(address) self.assertFalse(mock_get_osm_api.called) self.assertEqual(response.status_code, 400)