コード例 #1
0
ファイル: conversations_tests.py プロジェクト: vosechu/mltshp
 def test_creating_a_new_comment_creates_a_conversation(self):
     request = HTTPRequest(self.get_url('/p/%s/comment' % self.shf.share_key), 'POST', {'Cookie':'_xsrf=%s;sid=%s' % (self.xsrf, self.sid)}, "body=%s&_xsrf=%s" % (url_escape("a comment"), self.xsrf))
     self.http_client.fetch(request, self.stop)
     response = self.wait()
     
     conversations = Conversation.all()
     self.assertEqual(len(conversations), 2)
コード例 #2
0
def list_conversations(event, context):
    conversations = Conversation.all()

    response = {
        'statusCode': 200,
        'headers': {
            'Access-Control-Allow-Origin': '*'
        },
        'body': json.dumps(conversations)
    }

    return response
コード例 #3
0
ファイル: conversations_tests.py プロジェクト: vosechu/mltshp
    def test_deleting_a_file_will_set_conversation_to_muted(self):
        request = HTTPRequest(self.get_url('/p/%s/comment' % self.shf.share_key), 'POST', {'Cookie':'_xsrf=%s;sid=%s' % (self.xsrf, self.sid)}, "body=%s&_xsrf=%s" % (url_escape("a comment"), self.xsrf))
        self.http_client.fetch(request, self.stop)
        response = self.wait()

        request = HTTPRequest(self.get_url('/p/%s/comment' % self.shf.share_key), 'POST', {'Cookie':'_xsrf=%s;sid=%s' % (self.xsrf, self.sid)}, "body=%s&_xsrf=%s" % (url_escape("a second comment"), self.xsrf))
        self.http_client.fetch(request, self.stop)
        response = self.wait()

        self.shf.delete()
        
        conversations = Conversation.all()
        self.assertEqual(conversations[0].muted, 1)
        self.assertEqual(conversations[1].muted, 1)