Ejemplo n.º 1
0
 def test_setting_and_getting_current_stream(self):
     ask = Ask()
     with patch('flask_ask.core.find_ask', return_value=ask):
         self.assertEqual(_Field(), ask.current_stream)
     
         stream = _Field()
         stream.__dict__.update({'token': 'asdf', 'offsetInMilliseconds': 123, 'url': 'junk'})
         with patch('flask_ask.core.top_stream', return_value=stream):
             self.assertEqual(stream, ask.current_stream)
Ejemplo n.º 2
0
 def test_setting_and_getting_current_stream(self):
     ask = Ask()
     with patch('flask_ask.core.find_ask', return_value=ask):
         self.assertEqual(_Field(), ask.current_stream)
     
         stream = _Field()
         stream.__dict__.update({'token': 'asdf', 'offsetInMilliseconds': 123, 'url': 'junk'})
         with patch('flask_ask.core.top_stream', return_value=stream):
             self.assertEqual(stream, ask.current_stream)
Ejemplo n.º 3
0
    def test_setting_and_getting_current_stream(self):
        ask = Ask()
        with patch("flask_ask.core.find_ask", return_value=ask):
            self.assertEqual(_Field(), ask.current_stream)

            stream = _Field()
            stream.__dict__.update({
                "token": "asdf",
                "offsetInMilliseconds": 123,
                "url": "junk"
            })
            with patch("flask_ask.core.top_stream", return_value=stream):
                self.assertEqual(stream, ask.current_stream)
Ejemplo n.º 4
0
 def test_from_directive_call(self):
     ask = Ask()
     fake_stream = _Field()
     fake_stream.__dict__.update({'token': 'fake'})
     with patch('flask_ask.core.top_stream', return_value=fake_stream):
         from_buffer = ask._from_directive()
         self.assertEqual(fake_stream, from_buffer)
Ejemplo n.º 5
0
 def test_from_directive_call(self):
     ask = Ask()
     fake_stream = _Field()
     fake_stream.__dict__.update({'token':'fake'})
     with patch('flask_ask.core.top_stream', return_value=fake_stream):
         from_buffer = ask._from_directive()
         self.assertEqual(fake_stream, from_buffer)
Ejemplo n.º 6
0
    def test_get_slot(self):
        intent = get_intent('FakeIntent', 'CONFIRMED')
        intent['request']['intent'].update({
            "slots": {
                "fake": slot("fake", "value", "slot_id",
                             confirmed='CONFIRMED'),
            }
        })
        self.app.ask.request = _Field(intent['request'])

        fake_slot = get_slot('fake')

        self.assertEqual(fake_slot, {
            'raw': 'value',
            'value': 'value',
            'id': 'slot_id'
        })