예제 #1
0
파일: test_db.py 프로젝트: drewp/magma
 def testWritesToSeparateGraph(self):
     g1 = ConjunctiveGraph()
     g2 = ConjunctiveGraph()
     c = CommandLog(Graph2(g1, initNs=INITNS), Graph2(g2, initNs=INITNS))
     c.addCommand(CMD['c1'], dateTime('18:00:00'), USER['drewp'])
     self.assertEqual(len(g1), 0)
     self.assert_(len(g2) > 0)
예제 #2
0
파일: test_db.py 프로젝트: drewp/magma
 def testWritesToSeparateGraph(self):
     g1 = ConjunctiveGraph()
     g2 = ConjunctiveGraph()
     c = CommandLog(Graph2(g1, initNs=INITNS), Graph2(g2, initNs=INITNS))
     c.addCommand(CMD['c1'], dateTime('18:00:00'), USER['drewp'])
     self.assertEqual(len(g1), 0)
     self.assert_(len(g2) > 0)
예제 #3
0
파일: test_db.py 프로젝트: drewp/magma
 def testDoesntSendStrayClasses(self):
     pings = []
     self.graph.add((CMD['other'], RDF.type, CMD['Other']))
     self.cl = CommandLog(Graph2(self.graph, initNs=INITNS),
                          newCommandPing=lambda **kw: pings.append(kw))
     self.cl.addCommand(CMD['c2'], dateTime('18:00:00'), USER['drewp'])
     self.assertEqual(len(pings), 1)
예제 #4
0
파일: test_db.py 프로젝트: drewp/magma
    def testSendsPing(self):
        pings = []

        self.cl = CommandLog(Graph2(self.graph, initNs=INITNS),
                             newCommandPing=lambda **kw: pings.append(kw))
        self.cl.addCommand(CMD['c2'], dateTime('18:00:00'), USER['drewp'])
        self.assertEqual(pings, [{
            'content':
            'http://bigasterisk.com/command/http%3A//example.com/c2/1228183200.0/http%3A//example.com/user/drewp',
            'signal': 'http://example.com/Bright'
        }])
예제 #5
0
파일: test_db.py 프로젝트: drewp/magma
 def testDoesntSendStrayClasses(self):
     pings = []
     self.graph.add((CMD['other'], RDF.type, CMD['Other']))
     self.cl = CommandLog(Graph2(self.graph, initNs=INITNS),
                          newCommandPing=lambda **kw: pings.append(kw))
     self.cl.addCommand(CMD['c2'], dateTime('18:00:00'), USER['drewp'])
     self.assertEqual(len(pings), 1)
예제 #6
0
파일: test_db.py 프로젝트: drewp/magma
 def testSendsPing(self):
     pings = []
     
     self.cl = CommandLog(Graph2(self.graph, initNs=INITNS),
                          newCommandPing=lambda **kw: pings.append(kw))
     self.cl.addCommand(CMD['c2'], dateTime('18:00:00'), USER['drewp'])
     self.assertEqual(pings, [
         {'content': 'http://bigasterisk.com/command/http%3A//example.com/c2/1228183200.0/http%3A//example.com/user/drewp',
          'signal': 'http://example.com/Bright'}])
예제 #7
0
파일: test_db.py 프로젝트: drewp/magma
    def testSendsMultipleClasses(self):
        pings = []

        self.cl = CommandLog(Graph2(self.graph, initNs=INITNS),
                             newCommandPing=lambda **kw: pings.append(kw))
        self.graph.add((CMD['c2'], RDF.type, CMD['Volume']))  # second cls

        self.cl.addCommand(CMD['c2'], dateTime('18:00:00'), USER['drewp'])
        c = 'http://bigasterisk.com/command/http%3A//example.com/c2/1228183200.0/http%3A//example.com/user/drewp'
        self.assertEqual(
            sorted(pings),
            sorted([{
                'content': c,
                'signal': 'http://example.com/Bright'
            }, {
                'content': c,
                'signal': 'http://example.com/Volume'
            }]))
예제 #8
0
파일: test_db.py 프로젝트: drewp/magma
    def testSendsMultipleClasses(self):
        pings = []
        
        self.cl = CommandLog(Graph2(self.graph, initNs=INITNS),
                             newCommandPing=lambda **kw: pings.append(kw))
        self.graph.add((CMD['c2'], RDF.type, CMD['Volume'])) # second cls

        self.cl.addCommand(CMD['c2'], dateTime('18:00:00'), USER['drewp'])
        c = 'http://bigasterisk.com/command/http%3A//example.com/c2/1228183200.0/http%3A//example.com/user/drewp'
        self.assertEqual(sorted(pings), sorted([
            {'content': c, 'signal': 'http://example.com/Bright'},
            {'content': c, 'signal': 'http://example.com/Volume'}]))
예제 #9
0
파일: test_db.py 프로젝트: drewp/magma
 def testUsesSingleGraphForRW(self):
     g1 = ConjunctiveGraph()
     c = CommandLog(Graph2(g1, initNs=INITNS))
     c.addCommand(CMD['c1'], dateTime('18:00:00'), USER['drewp'])
     self.assert_(len(g1) > 0)
예제 #10
0
파일: test_db.py 프로젝트: drewp/magma
 def testUsesSingleGraphForRW(self):
     g1 = ConjunctiveGraph()
     c = CommandLog(Graph2(g1, initNs=INITNS))
     c.addCommand(CMD['c1'], dateTime('18:00:00'), USER['drewp'])
     self.assert_(len(g1) > 0)
예제 #11
0
파일: test_db.py 프로젝트: drewp/magma
 def setUp(self):
     super(WithGraph, self).setUp()
     self.graph = ConjunctiveGraph()
     self.graph.add((CMD['c2'], RDF.type, CMD['Bright']))
     self.cl = CommandLog(Graph2(self.graph, initNs=INITNS))