コード例 #1
0
class SlicerUpdateViewTest(TestCase):
    def setUp(self):
        self.slicer = SlicerFactory()
        self.update_url = self.slicer.get_absolute_url()
        self.post_data = dict(SlicerFactory.attributes())

    def test_get(self):
        response = self.client.get(self.update_url)
        self.assertContains(response, self.slicer.name)
        self.assertContains(response, self.slicer.query_string)
        self.assertContains(response, "Run Query")

    def test_post(self):
        response = self.client.post(self.update_url, data=self.post_data)
        self.assertRedirects(response, self.slicer.get_absolute_url())

        slicer = Slicer.objects.get(pk=self.slicer.pk)
        self.assertEqual(slicer.name, self.post_data['name'])
        self.assertEqual(slicer.query_string, self.post_data['query_string'])
コード例 #2
0
ファイル: views.py プロジェクト: FBK-WED/wed-pipe
class SlicerUpdateViewTest(TestCase):
    def setUp(self):
        self.slicer = SlicerFactory()
        self.update_url = self.slicer.get_absolute_url()
        self.post_data = dict(SlicerFactory.attributes())

    def test_get(self):
        response = self.client.get(self.update_url)
        self.assertContains(response, self.slicer.name)
        self.assertContains(response, self.slicer.query_string)
        self.assertContains(response, "Run Query")

    def test_post(self):
        response = self.client.post(self.update_url, data=self.post_data)
        self.assertRedirects(response, self.slicer.get_absolute_url())

        slicer = Slicer.objects.get(pk=self.slicer.pk)
        self.assertEqual(slicer.name, self.post_data['name'])
        self.assertEqual(slicer.query_string, self.post_data['query_string'])
コード例 #3
0
    def setUp(self):
        self.slicer = SlicerFactory(query_string="""
def nodes() {
    m = []
    g.V('type', 'sd:POI').filter{!!it['sd:acheneID']}[0..100].id.fill(m)
    return m
}

def slice(nodes_id) {
    m = []

    nodes_id.each{node_id ->
        g.v(node_id).transform({ poi ->
            data = [acheneID: poi['sd:acheneID']]

            tmp = []
            poi.out('bristle').order{
                -1 * (it.a.created <=> it.b.created)
            }.map.fill(tmp)

            data.name = tmp.collect{it['sd:name']}.findResults{it}[0]
            data.latitude = tmp.collect{it['sd:latitude']}?.findResults{it}[0]
            data.longitude = tmp.collect{
                it['sd:longitude']
            }?.findResults{it}[0]
            data.provenance = poi.out('bristle').out('source').name.collect{
                it}.join(',')

            if ([data.latitude, data.longitude].any{it == null}) {
                return null
            }

            return data
        }).filter{it != null}.fill(m)
    }

    return m
}
            """)
コード例 #4
0
ファイル: views.py プロジェクト: FBK-WED/wed-pipe
 def setUp(self):
     self.slicer = SlicerFactory()
     self.update_url = self.slicer.get_absolute_url()
     self.post_data = dict(SlicerFactory.attributes())
コード例 #5
0
ファイル: views.py プロジェクト: FBK-WED/wed-pipe
 def setUp(self):
     self.create_url = '/l/slicer/create/'
     self.post_data = dict(SlicerFactory.attributes())
コード例 #6
0
 def setUp(self):
     self.slicer = SlicerFactory()
     self.update_url = self.slicer.get_absolute_url()
     self.post_data = dict(SlicerFactory.attributes())
コード例 #7
0
 def setUp(self):
     self.create_url = '/l/slicer/create/'
     self.post_data = dict(SlicerFactory.attributes())
コード例 #8
0
 def setUp(self):
     self.slicer = SlicerFactory()